Displaying page
of
pages;
Items to
Title |
Test
Details
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
|
Title |
Test
Details
Pattern Title
|
Expression |
<(.*?)>
|
Description |
Can anyone help me with this problem? I want X to give me the correct index of >. For example if this is my code:
var MsgString="<button onclick='4>5?a():b();'>";
X=MsgString.search(/>/ig);
X will give me 18 instead of 30. How can I get it to ignore > that are within quotes? Please help. I would really appreciate it if anybody could give me some advice. Thanks so much.
-Logan
|
Matches |
<test a>
|
Non-Matches |
none
|
Author |
Rating:
Not yet rated.
Logan Tran
|
Displaying page
of
pages;
Items to