Title |
Test
Find
Pattern Title
|
Expression |
</?(\w+)(\s*\w*\s*=\s*("[^"]*"|'[^']'|[^>]*))*|/?> |
Description |
Matches HTML of XML tags, with or without attributes (single-, double-, or non-quoted), closing tags, or self-closing singleton tags. |
Matches |
<font color="blue"> | </font> | <br /> |
Non-Matches |
this is a test... |
Author |
Rating:
Not yet rated.
Jean-Philip Losier
|
Source |
Derived from Lewis Moten's expression that finds HTML tag properties |
Your Rating |
|
Title: x
Name: x
Date: 10/27/2008 9:52:13 AM
Comment:
<a href='mailto:[email protected]'>Jeff Potrykus</a> of the Journal Sentinel
Title: Close but no cigar
Name: Charles
Date: 7/23/2003 7:07:53 PM
Comment:
What about this, which is valid HTML:
<a href='test.asp'>link</a>
Title: "Never-ending" or "eternal" match -- update
Name: Mark
Date: 4/19/2003 7:03:43 PM
Comment:
Oops! I mean to write yours as ("[^"]*"|'[^']*'|[^>]*)* and this (?:"[^"]*"|'[^']*'|[^>])* to replace it. Here, I've added the noncapturing grouping (?: ).
Title: "Never-ending" or "eternal" match
Name: Mark
Date: 4/19/2003 6:57:34 PM
Comment:
You could remove the inner star of the two unlimited quantifiers in the subpattern ("[^"]"|'[^']'|[^>]*)* and avoid the possibility of a never-ending match, ("[^"]"|'[^']'|[^>])*. Alternatively, using "unrolling the loop" technique on this subpattern will protect against possible eternal matches and may also speed-up execution.