Title |
Test
Find
Pattern Title
|
Expression |
<[^>]*> |
Description |
HTML Pattern Matching
PLEASE HELP
/<[^>]*>/ig
The above pattern is only successful when html tag are simple (they don't include any javascript). This mean that the pattern will fail if something like this is within the tag <input type=button value=test onclick='if(n.value>5)do_this();'>. It will not match the entire open n close sign.
How do you write a pattern that will pass all these tag so that the pattern will match from the open to the close sign and not when it just see a > within a '' or "".
<input type=button onclick='if(n.value>5)do_this();'> not this <br>
<input type=button onclick="n>5?a():b();" value=test> not this <br>
<input type=button onclick="n>5?a(\"OK\"):b('Not Ok');" value=test> not this <br>
<input type=button onclick='n>5' value=test onmouseover="n<5&&n>8" onmouseout='if(n>5)alert(\'True\');else alert("False")'> not this <br>
Any help would be greatly appreciate. Thanks a whole lot.
Logan |
Matches |
<html> |
Non-Matches |
abc |
Author |
Rating:
Logan Tran
|
Source |
|
Your Rating |
|
Title: Try this one
Name: jackinthegreen
Date: 3/27/2009 11:04:29 AM
Comment:
All tags hex and non
((\%3C)|<)[^\n]+((\%3E)|>)
Title: Thanks!
Name: Matt
Date: 7/25/2007 10:36:45 AM
Comment:
This is exactly what I was looking for. I needed something to strip any and all tags and this was perfect =] Thanks
Title: Help for you
Name: Toby Henderson
Date: 6/8/2004 12:20:16 PM
Comment:
Logan this will match all your tags including attributes with javascript
http://www.regexlib.com/REDetails.aspx?regexp_id=746