user1622681
user1622681

Reputation: 93

Trying to figure out a regex answer

I am trying to match these items <script> or [cdata] or [html encoding or <html encoding. 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. 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.

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

Upvotes: 0

Views: 73

Answers (2)

Bohemian
Bohemian

Reputation: 425033

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

Upvotes: 0

user2932397
user2932397

Reputation: 184

I have no idea what to do with searching for that bracket as it is a part of reg-ex

you escape it using \

so \[ would match [

Upvotes: 1

Related Questions