JavaScript regex matches HTML

Source: Internet
Author: User
Tags closing tag

Regular expressions < (\s*?) [^>]*>.*?</\1>|<.*? />
The
does not match Abc|123|

Regular expressions ^[^<> ' ~!/@\#}$%:;) (_^{&*=| ') +]+$
The This is a test
does not match

Regular expressions &lt;! --. *?--&gt;
The &lt;! --&lt;h1&gt;this text has been removed&lt;/h1&gt; --&gt; | &lt;! --Yada--&gt;
does not match &lt;h1&gt;this text has not been removed&lt;/h1&gt;

Regular expressions (\[(\w+) \s* (([\w]*) = (' |&quot;)? ( [a-za-z0-9|:| \/|=|-|.| \?| &amp;] *) (\5)?) *\]) ([a-za-z0-9|:| \/|=|-|.| \?| &amp;|\s]+) (\[\/\2\])
The [link url=&quot;http://www.domain.com/file.extension?getvar=value&amp;secondvar=value&quot;] Link[/li
does not match [A]whatever[/b] | [a var1=something var2=somethingelse]whatever[/a] | [A]whatever[a]

Regular expressions Href=[\ "\"] (http:\/\/|\.\/|\/)? \w+ (\.\w+) * (\/\w+ (\.\w+)?) * (\/|\?\w*=\w* (&\w*=\w*) *)? [\"\‘]
The href= "www.yahoo.com" | href= "http://localhost/blah/" | href= "Eek"
does not match href= "" | Href=eek | Href= "bad Example"

Regular expressions &quot; ([^&quot;] (?:\ \.| [^\\&quot;] *) &quot;
The &quot; This is a \&quot;string\&quot;. &quot;
does not match &quot; This is a \&quot;string\&quot;.

Regular expressions (? I:on (Blur|c (Hange|lick) |dblclick|focus|keypress| ( Key|mouse) (Down|up) | (un) load|mouse (move|o (ut|ver)) |reset|s (Elect|ubmit))
The
onclick | onsubmit | onmouseover
does not match Click | Onandon | Mickeymouse

Regular expressions (? s)/\*.*\*/
The /* .................... */ | /* Imagine lots of lines here */
does not match */Malformed OPENING tag * * | /* Malformed closing tag/*

Regular expressions < (\s*?) [^>]*>.*?</\1>|<.*? />
The
does not match Abc|123|

Regular expressions \xa9
The ?
does not match Anything

Regular expressions SRC[^&GT;] *[^/]. (?: jpg|bmp|gif) (?:\ &quot;|\ ')
The Src=&quot, .... /images/image.jpg&quot; | src=&quot;http://domain.com/images/image.jpg&quot; | Src= ' d:\w
does not match Src=&quot, .... /images/image.tif&quot; | src=&quot;cid:value&quot;

Regular expressions /\*[\d\d]*?\*/
The /* My comment * * | /* My Multiline comment * * | /* My nested comment */
does not match */Anything here/* | Anything between 2 seperate comments | \* *\

Regular expressions <[a-za-z]+ (\s+[a-za-z]+\s*=\s* ("[^"]*) "| ([^ ']*) ') *\s*/>
The
does not match |

JavaScript regex matches HTML

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.