Displaying page
of
pages;
Items to
Title |
Test
Details
Pattern Title
|
Expression |
<[a-zA-Z]+(\s+[a-zA-Z]+\s*=\s*("([^"]*)"|'([^']*)'))*\s*/>
|
Description |
Matches a valid "empty" tag (has trailing slash). Note, if you run it against a string such as <img src="test.gif" alt="<hr />"> it will indeed return a match. But, the match is not at character 1 like you'd suspect, but rather it's matching the internal <hr />. If you look at the source of this tag (http://concepts.waetech.com/unclosed_tags/) you'll find a whoe suite of regex's for matching html tags. Using them you could feasibly step though a document and avoid this mismatch as the outer tag would match *in totality* and you'd completely skip this inner match.
|
Matches |
<img src="test.gif"/>
|
Non-Matches |
<img src="test.gif"> | <img src="test.gif"a/>
|
Author |
Rating:
Not yet rated.
Joshua Olson
|
Displaying page
of
pages;
Items to