I need to check the input string for text <script .
Example:
string a = "This is a simple <script> string";
Now I need to write a regular expression that will tell me whether this string contains a <script> or not.
In the end, I wrote something like: <* ?script.* ?>
But the problem is, the Incoming line may contain the script in the following ways:
string a = "This is a simple <script> string"; string a = "This is a simple < script> string"; string a = "This is a simple <javascript></javascript> string"; string a = "This is a simple <script type=text/javascript> string";
Therefore, the regular expression must check the start of the < tag, and then it must be checked against the script .
source share