简体   繁体   English

试图找出正则表达式答案

[英]Trying to figure out a regex answer

I am trying to match these items <script> or [cdata] or [html encoding or <html encoding. 我正在尝试匹配这些项目<script>[cdata][html编码或<html编码。 The words can be upper case or lowercase or a combo and I need to be able to find them and keep on finding them. 单词可以是大写或小写或组合,我需要能够找到它们并继续寻找它们。 Is my below answer close? 我下面的答案是否关闭? I have no idea what to do with searching for that bracket as it is a part of reg-ex. 我不知道如何处理该括号,因为它是reg-ex的一部分。 I am attempting to check with reg-ex 101 and reg-ex hero but both contradict the other and it is difficult to figure out which one is correct. 我正尝试与reg-ex 101和reg-ex hero进行核对,但两者相互矛盾,很难确定哪一个是正确的。

^.*<seescript|[cdata|%28|%3c|.*/i 

I have no idea what to do with searching for that bracket as it is a part of reg-ex 我不知道如何处理该括号,因为它是reg-ex的一部分

you escape it using \\ 您使用\\进行转义

so \\[ would match [ 因此\\ [会匹配[

It's unclear what you want, but if it's to find any of the following: 不清楚您想要什么,但是否可以找到以下任何一项:

  • <script>
  • [cdata[
  • [html
  • <html

Use this regex: 使用此正则表达式:

<script>|\[cdata\[|\[html\b|<html\b

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM