Displaying page
of
pages;
Items to
Title |
Test
Details
Pattern Title
|
Expression |
<[^>]*\n?.*=("|')?(.*\.jpg)("|')?.*\n?[^<]*> |
Description |
Match any image insert in a tag .
simply replace the .jpg in the pattern whit a variable of content type ex:.swf,.js,.gif and loop the pattern to retrieve all tag whit the contenttype pass trought....
Very useful when you have people uploading html document in your site and you want to retrieve all dependecy. |
Matches |
<td background="../img/img.jpg" > | <img src=img.jpg > | <img src='img.jpg' |
Non-Matches |
= img.jpg | img.jpg |
Author |
Rating:
Not yet rated.
Marc-Antoine Latour
|
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 |
^[0-9A-Za-z_ ]+(.[jJ][pP][gG]|.[gG][iI][fF])$ |
Description |
Matches HTML image leaf filenames. |
Matches |
good.gif | go d.GIf | goo_d.jPg |
Non-Matches |
junk | bad.bad.gif | slash\gif. |
Author |
Rating:
Not yet rated.
Geoffrey Swenson
|
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 |
((ht|f)tp(s?))(:((\/\/)(?!\/)))(((w){3}\.)?)([a-zA-Z0-9\-_]+(\.(com|edu|gov|int|mil|net|org|biz|info|name|pro|museum|co\.uk)))(\/(?!\/))(([a-zA-Z0-9\-_\/]*)?)([a-zA-Z0-9])+\.((jpg|jpeg|gif|png)(?!(\w|\W))) |
Description |
This expression matches valid image URLs. The main use for this would be in UBBC tags.
Written by RyanJ and Jick for FWD (http://flexwebdev.thenamesdan.com/) |
Matches |
http://www.location.com/images/image1.gif | http://www.location.com/images/mainImgs/image1.png |
Non-Matches |
/images/image1.jpeg | http://www.location.com/images/image1.swf | http://www.something.com/hello/..j |
Author |
Rating:
Ryan Jones
|
Title |
Test
Details
Pattern Title
|
Expression |
<(\/{0,1})img(.*?)(\/{0,1})\> |
Description |
This regular expression allows you to match all image tags |
Matches |
<img src="immy.jpg" alt="Image"> | <img src="immy.jpg" alt=&q |
Non-Matches |
< img > |
Author |
Rating:
Alessandro Pellegrini
|
Title |
Test
Details
Pattern Title
|
Expression |
<[iI][mM][gG]([^>]*[^/>]*[/>]*[>]) |
Description |
This is a derivation of a few other image tag regex patterns I found on the site that didn't seem to work. This is my first regex, so if I did this wrong - apologies in advance! It works for me... |
Matches |
<img src="/images/foo.gif" /> | <img src="/images/foo.gif"> |
Non-Matches |
unknown |
Author |
Rating:
Not yet rated.
Dain White
|
Title |
Test
Details
Pattern Title
|
Expression |
<[iI][fF][rR][aA][mM][eE]([^>]*[^/>]*[/>]*[>]) |
Description |
My second ever regex - a derivation of an image tag pattern, use in conjunction with <[iI][mM][gG]([^>]*[^/>]*[/>]*[>]) to remove advertisements from RSS feeds. Whee! |
Matches |
<IFRAME ...></IFRAME> |
Non-Matches |
unknown |
Author |
Rating:
Not yet rated.
Dain White
|
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
Pattern Title
|
Expression |
[ ]*=[ ]*[\"]*cid[ ]*:[ ]*([^\"<> ]+) |
Description |
This is a Microsoft .NET/Mono regular expression that can be used to find the address of an embedded image inside an HTML email body.
The address will be the 2nd group found in the match. |
Matches |
<img src="cid:00a601c57cba$14028d40$ed5cc23e"> | background=cid:034701c5d97f$7c12fba |
Non-Matches |
<img src="no.jpg"> |
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
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
Image File Extension
|
Expression |
.*(\.[Jj][Pp][Gg]|\.[Gg][Ii][Ff]|\.[Jj][Pp][Ee][Gg]|\.[Pp][Nn][Gg]) |
Description |
This expression should work to validate that an uploaded file's extension is either jpg, gif, or png. |
Matches |
foo.gif|foo.jpg|foo.png |
Non-Matches |
foo.txt|foo.zip|foo.exe |
Author |
Rating:
Not yet rated.
Steven Smith
|
Title |
Test
Details
Image without alt attribute (.Net only)
|
Expression |
\<img ((src|height|width|border)=:q:Wh*)*/\> |
Description |
This regex is good for finding image tags without alt tags. I used this for working on Section 508 compliance. This is a M$ flavored regex and probably won't work with anything else. |
Matches |
<ol><li><img src="pic.gif" width="84" height="119" border="0" /></li><li><img src="pic.gif" width="84" height="119"/></li><li><img src="pic.gif" width="84" border="0" /></li><li><img src="pic.gif" height="119" border="0" /></li><li><img src="pic.gif" border="0" /></li><li><img src="pic.gif" height="119" /></li><li><img width="84" height="119" border="0" src="pic.gif" /></li><li><img src="pic.gif"/></li><li><img src="pic.gif" /></li></ol> |
Non-Matches |
Any img tag with:<br><ol><li>An alt attribute</li><li>Javascript event function</li><li>Unquoted attributes</li><li>The ending / missing</li></ol> |
Author |
Rating:
Not yet rated.
Richard Binnington
|
Title |
Test
Details
Path & Filename in realtive path
|
Expression |
^(((\.\.){1}/)*|(/){1})?(([a-zA-Z0-9]*)/)*([a-zA-Z0-9]*)+([.jpg]|[.gif])+$ |
Description |
Nice for checking local filesystem relative pathing. I used it for testing in php scripts that work with images. |
Matches |
../../pictures/products/image.gif; ../image.jpg; image.gif |
Non-Matches |
http://www.domain.de/image.gif; ../../badscript.php; |
Author |
Rating:
Marcus
|
Title |
Test
Details
HTML Image src
|
Expression |
<[iI][mM][gG][a-zA-Z0-9\s=".]*((src)=\s*(?:"([^"]*)"|'[^']*'))[a-zA-Z0-9\s=".]*/*>(?:</[iI][mM][gG]>)* |
Description |
Great for extracting out all the image src attributes. |
Matches |
<img src="gif.gif" ></img>|<img id="blah" src="gif"></img>|<img src="gif.gif" id="freaky">|</img>|<img src="gif.gif" />|<img src="gif.gif"/>|<img class="FloatLeft Margin" id="calendarButton81" src="calendar.gif" alt="Calendar Button" /> |
Non-Matches |
<input id="" value=""/> |
Author |
Rating:
Erik
|
Title |
Test
Details
Image URL
|
Expression |
^(http\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(?:\/\S*)?(?:[a-zA-Z0-9_])+\.(?:jpg|jpeg|gif|png))$ |
Description |
A nice little regex to verify a URL pointing towards an image. Can be useful. |
Matches |
http://website.com/directory/image.gif |
Non-Matches |
www.website.com/image.php |
Author |
Rating:
Not yet rated.
tedcambron
|
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
|
Displaying page
of
pages;
Items to