RegExLib.com - The first Regular Expression Library on the Web!

Please support RegExLib Sponsors

Sponsors

Advanced Search

Keywords

Category

Minimum Rating

Results per Page

Search Results: 35 regular expressions found.

Change page:   |    Displaying page 1 of 2 pages; Items 1 to 20
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 &lt;img\1 /&gt; to convert image tags to XHTML compliant image tags.
Matches
<img src="bob">
Non-Matches
<img src="bob" />
Author Rating: The rating for this expression. 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(&quot;/(\[IMG\])(\S+?)(\[\/IMG\])/is&quot;, &quot;&lt;a href=\&quot;\\2\&quot; target=\&quot;_blank\&quot;&gt;&lt;IMG SRC=\&quot;\\2\&quot; align=\&quot;center\&quot; height=\&quot;100\&quot; border=\&quot;0\&quot;&gt;&lt;/a&gt;&quot;,$text); so whenever they use [img]http://www.foo.com/bleh.jpg[/img] it will be converted to &lt;a href=&quot;http://www.foo.com/bleh.jpg&quot; target=&quot;_blank&quot;&gt;&lt;IMG SRC=&quot;http://www.foo.com/bleh.jpg&quot; align=&quot;center&quot; height=&quot;100&quot; border=&quot;0&quot;&gt;&lt;/a&gt; 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
&lt;img src=&quot;bleh.jpg&quot;&gt;
Author Rating: The rating for this expression. 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[^&gt;]*[^/].(?:jpg|bmp|gif)(?:\&quot;|\')
Description
This expression will return the src (source) property of an image tag &lt;IMG&gt;. 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 &lt;BGSOUND&gt;, &lt;SCRIPT&gt;, 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 &lt;IMG&gt; tag, I would appreciate the effort.
Matches
src=&quot;../images/image.jpg&quot; | src=&quot;http://domain.com/images/image.jpg&quot; | src='d:\w
Non-Matches
src=&quot;../images/image.tif&quot; | src=&quot;cid:value&quot;
Author Rating: The rating for this expression. 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: The rating for this expression. Ryan Jones
Title Test Details Pattern Title
Expression
&lt;(\/{0,1})img(.*?)(\/{0,1})\&gt;
Description
This regular expression allows you to match all image tags
Matches
&lt;img src=&quot;immy.jpg&quot; alt=&quot;Image&quot;&gt; | &lt;img src=&quot;immy.jpg&quot; alt=&q
Non-Matches
&lt; img &gt;
Author Rating: The rating for this expression. Alessandro Pellegrini
Title Test Details Pattern Title
Expression
&lt;[iI][mM][gG]([^&gt;]*[^/&gt;]*[/&gt;]*[&gt;])
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
&lt;img src=&quot;/images/foo.gif&quot; /&gt; | &lt;img src=&quot;/images/foo.gif&quot;&gt;
Non-Matches
unknown
Author Rating: Not yet rated. Dain White
Title Test Details Pattern Title
Expression
&lt;[iI][fF][rR][aA][mM][eE]([^&gt;]*[^/&gt;]*[/&gt;]*[&gt;])
Description
My second ever regex - a derivation of an image tag pattern, use in conjunction with &lt;[iI][mM][gG]([^&gt;]*[^/&gt;]*[/&gt;]*[&gt;]) to remove advertisements from RSS feeds. Whee!
Matches
&lt;IFRAME ...&gt;&lt;/IFRAME&gt;
Non-Matches
unknown
Author Rating: Not yet rated. Dain White
Title Test Details Pattern Title
Expression
&lt;img .+ src[ ]*=[ ]*\&quot;(.+)\&quot;
Description
Gets the image url in an HTML &lt;IMG&gt; tag.
Matches
&lt;img src=&quot;test.jpg&quot;&gt; | &lt;img align = &quot;left&quot; src = &quot;test.jpg&quot;&g
Non-Matches
unknown
Author Rating: Not yet rated. Judah Himango
Title Test Details Pattern Title
Expression
[ ]*=[ ]*[\&quot;]*cid[ ]*:[ ]*([^\&quot;&lt;&gt; ]+)
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
&lt;img src=&quot;cid:00a601c57cba$14028d40$ed5cc23e&quot;&gt; | background=cid:034701c5d97f$7c12fba
Non-Matches
&lt;img src=&quot;no.jpg&quot;&gt;
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>&lt;img src="pic.gif" width="84" height="119" border="0" /&gt;</li><li>&lt;img src="pic.gif" width="84" height="119"/&gt;</li><li>&lt;img src="pic.gif" width="84" border="0" /&gt;</li><li>&lt;img src="pic.gif" height="119" border="0" /&gt;</li><li>&lt;img src="pic.gif" border="0" /&gt;</li><li>&lt;img src="pic.gif" height="119" /&gt;</li><li>&lt;img width="84" height="119" border="0" src="pic.gif" /&gt;</li><li>&lt;img src="pic.gif"/&gt;</li><li>&lt;img src="pic.gif" /&gt;</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: The rating for this expression. 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: The rating for this expression. 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: The rating for this expression. Charles Forsyth
Change page:   |    Displaying page 1 of 2 pages; Items 1 to 20

Copyright © 2001-2024, RegexAdvice.com | ASP.NET Tutorials