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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Pattern Title
Expression
^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w ]*.*))+\.(jpg|JPG)$
Description
It matches .jpg files. It allows for a dot in the path. A dot may occur in such directories as: C:\Documents and Settings\roman.lukyanenko\Desktop\stuff\b_card2.jpg or C:\Windows\Microsoft.NET etc
Matches
C:\Documents and Settings\roman.lukyanenko\Desktop\stuff\b_card2.jpg | C:\b_card.jpg | \\network\fol
Non-Matches
C:\file.xls
Author Rating: The rating for this expression. Roman Lukyanenko
Source
Your Rating
Bad Good

Enter New Comment

Title
 
Name
 
Comment
 
Spammers suck - we apologize. Please enter the text shown below to enable your comment (not case sensitive - try as many times as you need to if the first ones are too hard):

Existing User Comments

Title: Suggestion for modification
Name: Abhishek
Date: 7/27/2014 7:14:34 AM
Comment:
permit both "/" and "\" to be separators for a file path.Your regex only allows "\".


Title: Suggestion for modification
Name: Abhishek
Date: 7/27/2014 7:13:20 AM
Comment:
permit both "/" and "\" to be separators for a file path.Your regex only allows "\".


Title: sadf
Name: asdf
Date: 10/18/2011 7:57:59 AM
Comment:
asdf


Title: More paths
Name: james
Date: 7/18/2008 12:06:12 PM
Comment:
JPG or PNG Image filepath Windows path or Network Path ^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w ]*.*))+\.(([Jj][Pp][eE]{0,1}[Gg])|([pP][nN][gG]))$ JPG or PNG Image filepath for unix based systems ^[/]*([^/\\ \:\*\?"\<\>\|\.][^/\\\:\*\?\"\<\>\|]{0,63}/)*[^/\\ \:\*\?"\<\>\|\.][^/\\\:\*\?\"\<\>\|]{0,63}(\.([jJ][pP][eE]{0,1}[gG])|([pP][nN][gG]))$ JPG or PNG image file path combined ^((([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w ]*.*))+\.(([Jj][Pp][eE]{0,1}[Gg])|([pP][nN][gG])))|([/]*([^/\\ \:\*\?"\<\>\|\.][^/\\\:\*\?\"\<\>\|]{0,63}/)*[^/\\ \:\*\?"\<\>\|\.][^/\\\:\*\?\"\<\>\|]{0,63}(([\.]{1}[jJ][pP][eE]{0,1}[gG])|([\.]{1}[pP][nN][gG])))$


Title: With Case Sensitive
Name: Guilleramone
Date: 10/25/2007 10:06:14 AM
Comment:
^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w ]*.*))+\.([Jj][Pp][Gg])$


Title: not case insensitve
Name: bryanc
Date: 11/3/2006 4:59:28 AM
Comment:
this is not case insensitive. .Jpg will fail.


Title: Perfect
Name: Kenneth
Date: 4/5/2004 8:00:06 AM
Comment:
Just what I wanted!


Title: Do you have any expression?
Name: Ajai Kumar .R
Date: 1/9/2004 10:00:38 AM
Comment:
Hai, I've an HTML page say it would be something like below <html> <body> <img src="http://www.site.com/a.gif"> <img src="file:\\\c:\b.doc"> <table background="c.jpg">... <table style="url(d.jpg)">... <a href='e.html'>... and so on. here i need to fetch the file names alone from the content... Could you please give me some expression. Thanks in advance. Ajai Kumar .R </body>


Title: Dollar sign?
Name: Darren Neimke
Date: 12/31/2003 6:42:37 PM
Comment:
Hi Roman, nice pattern. Out of interest though, isn't the escaped dollar sign superfluous? You have it as: \$? But, I'm not sure when that would get used? I presumed that you had it there to match an admin share on a mapped network drive such as: \\foo\C$\want.jpg but, as you can see the $ sign is actually in the next segment from where you have it in the pattern so, I'm not sure that it will ever get used? Cheers, - Darren http://regexblogs.com/DNeimke


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