Displaying page
of
pages;
Items to
Title |
Test
Details
Pattern Title
|
Expression |
<img([^>]*[^/])> |
Description |
Use this along with this replacement string <img\1 /> to convert image tags to XHTML compliant image tags.
|
Matches |
<img src="bob"> |
Non-Matches |
<img src="bob" /> |
Author |
Rating:
Murray Roke
|
Title |
Test
Details
Pattern Title
|
Expression |
(\[[Ii][Mm][Gg]\])(\S+?)(\[\/[Ii][Mm][Gg]\]) |
Description |
easy when you want to allow your users to post images, but in a controlled way. I used it like this (in php):
$text = preg_replace("/(\[IMG\])(\S+?)(\[\/IMG\])/is", "<a href=\"\\2\" target=\"_blank\"><IMG SRC=\"\\2\" align=\"center\" height=\"100\" border=\"0\"></a>",$text);
so whenever they use
[img]http://www.foo.com/bleh.jpg[/img]
it will be converted to
<a href="http://www.foo.com/bleh.jpg" target="_blank"><IMG SRC="http://www.foo.com/bleh.jpg" align="center" height="100" border="0"></a>
so you get a 100 pixels high picture, and when they click on it it opens in a new window...
(to prevent users from posting huge pictures and stuff) |
Matches |
[IMG]http://bleh.jpg[/IMG] | [ImG]bleh[/imG] | [img]ftp://login: [email protected][/img] |
Non-Matches |
<img src="bleh.jpg"> |
Author |
Rating:
marnik vander elst
|
Title |
Test
Details
Pattern Title
|
Expression |
<[iI][mM][gG]([^>]*[^/>]) |
Description |
simple little RegExp to get the IMG tag from HTML |
Matches |
<img src="abc.jpg"> | <img src="abc.jpg"/> | <ImG src="abc.j |
Non-Matches |
none |
Author |
Rating:
Not yet rated.
Asim Goheer
|
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 |
<([^\s>]*)(\s[^<]*)> |
Description |
grab all tags attributes...
<img src="truc"> returns :
<
(1:img)
(2: src="truc")
>
i use it to clean html pages to grab infos...
use a RegEx Replace with "<$1>" to keep only tags codes... |
Matches |
<img src="truc"> | <body background='...'> | <p align='left'> |
Non-Matches |
<br> | </body> | <p> |
Author |
Rating:
Not yet rated.
Tanguy Pruvot
|
Title |
Test
Details
Pattern Title
|
Expression |
src[^>]*[^/].(?:jpg|bmp|gif)(?:\"|\') |
Description |
This expression will return the src (source) property of an image tag <IMG>. The source returned is limited to the file extensions supplied. It doesn't matter if the image is prefixed with '../' or 'http://..blah' or 'drive\path' or nothing. This expression could be modifed to return other sources or for the tags (ie <BGSOUND>, <SCRIPT>, etc.) depending on the file extensions given.
I needed this to replace the source of images in a HTML page when I wanted to save the page to a local drive and keep the images intact.
If anybody could modify this further to include only the <IMG> tag, I would appreciate the effort. |
Matches |
src="../images/image.jpg" | src="http://domain.com/images/image.jpg" | src='d:\w |
Non-Matches |
src="../images/image.tif" | src="cid:value" |
Author |
Rating:
Lloyd Sturge
|
Title |
Test
Details
Pattern Title
|
Expression |
<img .+ src[ ]*=[ ]*\"(.+)\" |
Description |
Gets the image url in an HTML <IMG> tag. |
Matches |
<img src="test.jpg"> | <img align = "left" src = "test.jpg"&g |
Non-Matches |
unknown |
Author |
Rating:
Not yet rated.
Judah Himango
|
Title |
Test
Details
img
|
Expression |
<img[^>]* src=\"([^\"]*)\"[^>]*> |
Description |
It searches for a IMG tag and group information about source of image. |
Matches |
<img src="joka.jpg" /> <img src="joka.jpg"> |
Non-Matches |
<img> <img src=dada> |
Author |
Rating:
Not yet rated.
Jan Filipowski
|
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
Manage img
|
Expression |
<img[\s]+[^>]*?((alt*?[\s]?=[\s\"\']+(.*?)[\"\']+.*?)|(src*?[\s]?=[\s\"\']+(.*?)[\"\']+.*?))((src*?[\s]?=[\s\"\']+(.*?)[\"\']+.*?>)|(alt*?[\s]?=[\s\"\']+(.*?)[\"\']+.*?>)|>) |
Description |
This pattern can intercept img like < img src="src1" alt="alt1"> or < img alt="alt1" src="src1"> or < img src="src1"> or < img src="src1" width=3 height=4> then values of src can be found in $5 or $8, the value of tag alt can be found in $3 or $10. |
Matches |
< img src="src 1" alt="alt 1"> or < img src="src 2"> or < img src="src 3" alt="alt 3" width=2 height=3> |
Non-Matches |
any other tag |
Author |
Rating:
Cordisco Massimo
|
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
Match Valid HTML Tags As Browser
|
Expression |
<(/)?(a|abbr|acronym|address|applet|area|b|base|basefont|bdo|big|blockquote|body|br|button|caption|center|cite|code|col|colgroup|dd|del|dir|div|dfn|dl|dt|em|fieldset|font|form|frame|frameset|h[1-6]|head|hr|html|i|iframe|img|input|ins|isindex|kbd|label|legend|li|link|map|menu|meta|noframes|noscript|object|ol|optgroup|option|p|param|pre|q|s|samp|script|select|small|span|strike|strong|style|sub|sup|table|tbody|td|textarea|tfoot|th|thead|title|tr|tt|u|ul|var|xmp){1}(\s(\"[^\"]*\"*|[^>])*)*> |
Description |
This should match all valid HTML 4.01 tags as a browser would recognize. If you miss a 2nd " it will continue until it finds one to pair with, so if it doesn't find one, it continues until the end. This is how most browsers work I believe. It does have a few flaws, it will match </img> and </input> which is weird, but perhaps I'll fix that eventually. |
Matches |
</a> <h2 > </h2 asfsdf> <a href="abc>>123"> |
Non-Matches |
< /a> </h 2 asfsdf> <ahref="abc123"> |
Author |
Rating:
John Smith
|
Title |
Test
Details
Floating Complex Number Accessible
|
Expression |
^((?<r>([-+]?(\d+\.?\d*|\d*\.?\d+)([Ee][-+]?[0-2]?\d{1,2})?[r]?))|(?<i>([-+]?((\d+\.?\d*|\d*\.?\d+)([Ee][-+]?[0-2]?\d{1,2})?)?[i]))|(?<r>([-+]?(\d+\.?\d*|\d*\.?\d+)([Ee][-+]?[0-2]?\d{1,2})?[r]?))(?<i>([-+]((\d+\.?\d*|\d*\.?\d+)([Ee][-+]?[0-2]?\d{1,2})?)?[i])))$ |
Description |
This is the same regex pattern as 'Floating Complex Number' but extented by group names. This makes it much easier to extract the parts of the complex number (e.g. string realPart=myMatch.Result("${r}");string imgPart=myMatch.Result("${i}"); ). |
Matches |
see base example |
Non-Matches |
see base example |
Author |
Rating:
Not yet rated.
Fischer, M.
|
Title |
Test
Details
IMG tag
|
Expression |
<img[^>]*src=\"?([^\"]*)\"?([^>]*alt=\"?([^\"]*)\"?)?[^>]*> |
Description |
Use this RegExp to grab SRC($1) and ALT($3) values from IMG tags in valid or invalid HTML (XHTML). SRC param must by before IMG. (thanks to mr. Mrva) |
Matches |
<img src="xxx"> | <img src=xxx> | <img src="xxx" alt="xxx" /> | <img src="xxx" alt="xxx" width="N" height="N" /> | etc. |
Non-Matches |
<img> | <img /> | <img alt="XXX" src="XXX"> |
Author |
Rating:
Martin Švec
|
Title |
Test
Details
Capture HTML Tags
|
Expression |
<font[a-zA-Z0-9_\^\$\.\|\{\[\}\]\(\)\*\+\?\\~`!@#%&-=;:'",/\n\s]*> |
Description |
This expression will capture font tags(or any other HTML tag if you change the word font in the expression) with parameters and stop at the closing font tag bracket. The only keyboard characters it will not find between the starting and ending bracket are additional brackets. So for example if you are looking for image tags it will not find <img src="..." alt=">My Picture<"> due to the nested brackets. When I allowed nested brackets like this the expression did not always return only the tag I was looking for. Sometimes it returned additional tags at the end so I suggest staying away from brackets in alt text and anywhere else you may be allowed to do it. |
Matches |
<font color="#006666">, <font face="arial" style="font-size: 11pt"> |
Non-Matches |
<font, </font>, <font <> |
Author |
Rating:
Not yet rated.
Kurt McEllhenney
|
Title |
Test
Details
Strip HTML tags with exceptions
|
Expression |
<\/*?(?![^>]*?\b(?:a|img)\b)[^>]*?> |
Description |
This regex will match all HTML tags except 'a' tags or 'img' tags. You can edit the list of exclusions as you see fit. I use this regex to strip all HTML tags from source data except anchor tags and image tags. |
Matches |
<script> </html> <anytag> |
Non-Matches |
<a> <img /> </a> |
Author |
Rating:
Charles Forsyth
|
Title |
Test
Details
Parse HTML images
|
Expression |
"<[ \t]*[iI][mM][gG][ \t]*[sS][rR][cC][ \t]*=[ \t]*['\"]([^'\"]+)" |
Description |
Get all images in html string, ignore white space, tabs and is case insensitive. the result is iMG sRc ="ricardo.gif, after this just split the string and Enjoy it! |
Matches |
"<html><iMG sRc = \"ricardo.gif\" alt=\"1\"/><img src=\"whatever.gif\" /><img src =\"teste.gif\" alt=\"1\"/></html>" |
Non-Matches |
i don´t know |
Author |
Rating:
Ricardo Deus
|
Title |
Test
Details
Valid YouTube links
|
Expression |
(http://)?(www\.)?(youtube|yimg|youtu)\.([A-Za-z]{2,4}|[A-Za-z]{2}\.[A-Za-z]{2})/(watch\?v=)?[A-Za-z0-9\-_]{6,12}(&[A-Za-z0-9\-_]{1,}=[A-Za-z0-9\-_]{1,})* |
Description |
Matches only valid YouTube links. This includes directly linked videos (yimg) and using YouTube's shortening service (youtu.be). Also supports local domains, like youtube.nl, youtube.de, youtube.co.uk, etc. |
Matches |
www.youtube.co.uk/watch?v=KUlv7qraZaM | http://www.yimg.com/watch?v=KUlv7qraZaM | http://www.youtube.com/watch?v=apxKFXJ8jSg&feature=relmfu | youtu.be/apxKFXJ8jSg |
Non-Matches |
youtube.com/watch/v=apxKFXJ8jSg |
Author |
Rating:
Not yet rated.
Pim Stoit
|
Displaying page
of
pages;
Items to