regex - Client side validation, Regext to match tag,or how to validate blog post to prevent script posting -


I was looking for regex to match the speed tag, I used ASP.NET MVC 3.0 humorous recognition I am here.

I get this regexp "^ [[script | (| | | \ N)? & Gt; (| | \ N) *? & Lt; / script & gt;] * $" found

How to fix this?

Here are some examples:

Here are some examples:

1)

  & lt; Script & gt; Warning ("a"); & Lt; / Script & gt; & Lt; Div style = "clear: both" & gt; & Lt; Br / & gt; & Lt; / Div & gt;   

2)

  & lt; Script src = "/ anypath" type = "text / javascript" & gt; Antything & lt; / Script & gt; & Lt; Div style = "clear: both" & gt; & Lt; Br / & gt; & Lt; / Div & gt;   

3)

  & lt; Div style = "clear: both" & gt; & Lt; Br / & gt; & Lt; / Div & gt; & Lt; Script & gt; & Lt; / Script & gt;   

What I'm doing - I want to validate blog post input to stop the post script as a part of the blog post.

I think you will match the script tag with simple regex:

  (& lt; script. *? & Gt;. *? & Lt; / script & gt;)    

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -