Displaying page
of
pages;
Items to
Title |
Test
Details
Pattern Title
|
Expression |
</?(\w+)(\s+\w+=(\w+|"[^"]*"|'[^']*'))*> |
Description |
Finds any HTML tag and sub-matches properties weather it has an apposterphee, quote, or no quote/apposterphee
|
Matches |
<TD> | <TD bgColor="FFFFFF"> | </TD> |
Non-Matches |
No Tag Here ... |
Author |
Rating:
Lewis Moten
|
Title |
Test
Details
Pattern Title
|
Expression |
<[a-zA-Z][^>]*\son\w+=(\w+|'[^']*'|"[^"]*")[^>]*> |
Description |
Find HTML tags that have javascript events attached to them. |
Matches |
<IMG onmouseover="window.close()"> |
Non-Matches |
<IMG src="star.gif"> |
Author |
Rating:
Not yet rated.
Lewis Moten
|
Title |
Test
Details
Pattern Title
|
Expression |
^<a\s+href\s*=\s*"http:\/\/([^"]*)"([^>]*)>(.*?(?=<\/a>))<\/a>$ |
Description |
Regexp to find all external links in a HTML string.
Can easily be modified to handle all/other links/protocols (like file/https/ftp).
Uses lookahead assertions and non-greedy modifier to check for the end </a> but still allow html tags inbetween start and end A tag.
Takes into account that there could be linebreaks and other nasty whitespace chars in the middle of the tag.
I am using it to find all external links in embedded HTML code and change 1.the target of the link 2.insert a "Leaving Site" logo to illustrate you are leaving site. |
Matches |
<a href="http://www.mysite.com">my external link</a> | <a href="http:/ |
Non-Matches |
<a href="myinternalpage.html">my internal link</a> |
Author |
Rating:
Not yet rated.
Anders Rask
|
Title |
Test
Details
Pattern Title
|
Expression |
>(?:(?<t>[^<]*)) |
Description |
Detects HTML tags open and/or closed with and without whitespace or characters in between. Good for stripping all tags from a string. |
Matches |
<b> | </b> | <p><b>some text</b></p> |
Non-Matches |
< |
Author |
Rating:
Not yet rated.
Jonathan Crossland
|
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
|
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 |
href=[\"\'](http:\/\/|\.\/|\/)?\w+(\.\w+)*(\/\w+(\.\w+)?)*(\/|\?\w*=\w*(&\w*=\w*)*)?[\"\'] |
Description |
I wrote up this regular expression to fetch the href attribute found in <a> tags as well as a few other HTML tags. |
Matches |
href="www.yahoo.com" | href="http://localhost/blah/" | href="eek" |
Non-Matches |
href="" | href=eek | href="bad example" |
Author |
Rating:
Andrew Lee
|
Title |
Test
Details
Pattern Title
|
Expression |
<a[a-zA-Z0-9 ="'.:;?]*(name=){1}[a-zA-Z0-9 ="'.:;?]*\s*((/>)|(>[a-zA-Z0-9 ="'<>.:;?]*</a>)) |
Description |
This expression matches only valid html anchors. Those are anchors with an attribute name=. Such anchor can be closed either with </a> or with />.
If someone can help - one thing still missing is not matching html tags with parameter href, becazse such should be considered as non valid anchors. |
Matches |
<a name="anchorName">Anchor</a> | <a name=anchorName /> |
Non-Matches |
<a href="somewhere"> | <a href> | <a name /> |
Author |
Rating:
Aleš Potocnik
|
Title |
Test
Details
Pattern Title
|
Expression |
(?<TAG>\s*<(?<TAG_NAME>\w*)\s+(?<PARAMETERS>(?<PARAMETER>(?<PARAMETER_NAME>\w*)(=["']?)(?<VALUE>[\w\W\d]*?)["']?)+)\s*/?>) |
Description |
Parse html tags to extract tag names and parameters with parameter name/value pairs. |
Matches |
<td valign="top" align="left" colspan="2"> |
Non-Matches |
<!--dynamic_content GlobalID=49113--> |
Author |
Rating:
Maxim Paukov
|
Title |
Test
Details
Pattern Title
|
Expression |
<a[a-zA-Z0-9 ="'.:;?]*(href=[\"\'](http:\/\/|\.\/|\/)?\w+(\.\w+)*(\/\w+(\.\w+)?)*(\/|\?\w*=\w*(&\w*=\w*)*)?[\"\'])*(>[a-zA-Z0-9 ="'<>.:;?]*</a>) |
Description |
i've merged two regular expression those i found on this site. thanks to the owners "Aleš Potocnik and
Andrew Lee ". i used their expression to make mine. this expression finds the URL/Hyperlink with the HTML tags. |
Matches |
<a href="http://www.google.co.in/hi">Hindi</a> |
Non-Matches |
href="http://www.google.co.in/hi" |
Author |
Rating:
Not yet rated.
himraj love
|
Title |
Test
Details
Self Close Valid HTML Tags
|
Expression |
<(?<!\\?|\\/)([^>]*)>\\r*\\n<\\/(?=br|hr|img|input|link|param)[^>]*>
|
Description |
This pattern searches for tags in HTML that should be self closing but currently aren't and self closes them. This is useful if you are doing some HTML parsing. |
Matches |
<br> CRLF </br> etc. |
Non-Matches |
<textarea> CRLF </textarea> etc. |
Author |
Rating:
Not yet rated.
Iain Dooley
|
Title |
Test
Details
replace html tags with valid xhtml
|
Expression |
(<input )(.*?)(>) |
Description |
Finds all <input attrib1="value1" attrib2="value2" ... > tags. You can make it end with "/>" for xhtml compatibility replacing with the expression "<input $2 />". You can repeat it with other tags like <img /> or <br / > |
Matches |
<input attrib1="value1" attrib2="value2" > |
Non-Matches |
any other tag |
Author |
Rating:
Not yet rated.
Mauricio Venanzoni
|
Title |
Test
Details
Img Src Attribute
|
Expression |
src=(?:\"|\')?(?<imgSrc>[^>]*[^/].(?:jpg|bmp|gif|png))(?:\"|\')? |
Description |
This pattern matches an image url attribute of an img html tag. It searches for the src attribute and grabs the value as a grouped match - "imgSrc". |
Matches |
src="http://www.thoughtlava.com/images/logo.gif" | src='http://www.thoughtlava.com/images/logo.gif' | src=http://www.thoughtlava.com/images/logo.gif |
Non-Matches |
src="http://www.thoughtlava.com/images/logo.wmf" |
Author |
Rating:
Not yet rated.
Steven Pena
|
Title |
Test
Details
Find <h1> Tags
|
Expression |
<h([1-6])>([^<]*)</h([1-6])> |
Description |
This regex find valid <h1-6> html tags |
Matches |
<h2>test2</h2><h3>test3</h3> |
Non-Matches |
<h>test1</h> |
Author |
Rating:
Syrprize
|
Title |
Test
Details
HTML Anchor tag
|
Expression |
<a\s+(?:(?:\w+\s*=\s*)(?:\w+|"[^"]*"|'[^']*'))*?\s*href\s*=\s*(?<url>\w+|"[^"]*"|'[^']*')(?:(?:\s+\w+\s*=\s*)(?:\w+|"[^"]*"|'[^']*'))*?>[^<]+</a> |
Description |
This will match an entire HTML tag and will capture the href portion into the named capture "url". It will match any anchor tag with any number of attributes. |
Matches |
The entire <a href=""></a> tag |
Non-Matches |
Links that include any html within the tag. |
Author |
Rating:
Derek Pinkerton
|
Title |
Test
Details
Does string have HTML in it?
|
Expression |
[\w*|\W*]*<[[\w*|\W*]*|/[\w*|\W*]]>[\w*|\W*]* |
Description |
This will match true if the string contians at least one HTML tag. |
Matches |
This containt <HTML> tags. <B> Bold! </B> |
Non-Matches |
This text does not contain HTML. |
Author |
Rating:
Chris Pietschmann
|
Title |
Test
Details
HREF
|
Expression |
(?<=<(\S|\s)*)((?<=(href=('|")+))|(?<=(href=))[^('|")])([^'>"\s)]*)(?=('|"|[\S])?) |
Description |
This will pull the HREF values out of any HTML tag in a query and present only the HREF values. It's very versatile, it can accept a number of nonstandard formats. |
Matches |
HTML HREF values -- <a href=dir/file.php> & <a href="http://www.google.com" target="_blank"> & <a target="_blank" href="otherfile.php"> |
Non-Matches |
Plaintext or non HREF VALUES |
Author |
Rating:
arbitar
|
Title |
Test
Details
ISIN number between ><
|
Expression |
(?<=>)[A-Z]{2}[\d|\w]{9}\d{1}(?=(<)) |
Description |
ISIN must be located inside a html tag eg. <td>JP3756600007</td>. Just remove the (..) at the beginning and the end if you wish to match all ISINs. |
Matches |
>JP3756600007< without brackets |
Non-Matches |
JP3756600007 |
Author |
Rating:
Not yet rated.
MT
|
Title |
Test
Details
List HTML tags
|
Expression |
<(?![!/]?[ABIU][>\s])[^>]*> |
Description |
Used to return all the html tags and closing tags in a section of html. Can be used to replace all the tags with nothing or itterate through them. |
Matches |
<u><b>hello</b></u> |
Non-Matches |
hello |
Author |
Rating:
Not yet rated.
Richard Brisley
|
Title |
Test
Details
Remove (X)HTML like tags
|
Expression |
<\s*?[^>]+\s*?> |
Description |
This simple pattern is useful for removing all HTML tags with or without atributes. It has no removing white spaces |
Matches |
< html > | < div style="title_1" class='number'> | < div style="title_1" class='number' > | < img src="img.gif" / > |
Non-Matches |
Plain text |
Author |
Rating:
Shreeve
|
Displaying page
of
pages;
Items to