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

Please support RegExLib Sponsors

Sponsors

Expressions by User

   Displaying page 1 of 1 pages; Items 1 to 5
Title Test Details URL
Expression
^(http(?:s)?\:\/\/[a-zA-Z0-9]+(?:(?:\.|\-)[a-zA-Z0-9]+)+(?:\:\d+)?(?:\/[\w\-]+)*(?:\/?|\/\w+\.[a-zA-Z]{2,7}(?:\?[\w]+\=[\w\-]+)?)?(?:\&[\w]+\=[\w\-]+)*)$
Description
A simple but powerful URL validating regex. Accepts multiple sub-domains and sub-directories. Even accepts query strings ande ports! Accepts HTTP or HTTPS. Also accepts optional "/" on end of address. This may be the mother of all URL regexes. It's much more stricter than most others that do far less.
Matches
http://website.com | http://subdomain.web-site.com/cgi-bin/perl.cgi?key1=value1&key2=value2
Non-Matches
http://website.com/perl.cgi?key= | http://web-site.com/cgi-bin/perl.cgi?key1=value1&key2
Author Rating: Not yet rated. Ted Cambron
Title Test Details Email
Expression
^([a-zA-Z0-9]+(?:[.-]?[a-zA-Z0-9]+)*@[a-zA-Z0-9]+(?:[.-]?[a-zA-Z0-9]+)*\.[a-zA-Z]{2,7})$
Description
Yet another regex to help validate email addresses. This will work for 99% of all email addresses entered into the average website form. Stricter than RFC2822.
Matches
name@email.com
Non-Matches
_name@.email.com
Author Rating: Not yet rated. Ted Cambron
Title Test Details Image URL
Expression
^(http\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,7}(?:\/[\w\-]+)*\.(?:jpg|jpeg|gif|png))$
Description
An overly simple regex to verify a URL pointing towards an image. It's usually all you need for this purpose.
Matches
http://website.com/directory/image.gif
Non-Matches
www.website.com/image.php
Author Rating: Not yet rated. Ted Cambron
Title Test Details Query String
Expression
^((?:\?[a-zA-Z0-9_]+\=[a-zA-Z0-9_]+)?(?:\&[a-zA-Z0-9_]+\=[a-zA-Z0-9_]+)*)$
Description
This is a very simple regex that check the query part of a string. That is to say anything after the "?" at the end of an URL.
Matches
?key=value | ?key1=value1&key2=value2
Non-Matches
key=value | ?key=value&
Author Rating: Not yet rated. Ted Cambron
Title Test Details Absolute Path
Expression
^((?:\/[a-zA-Z0-9]+(?:_[a-zA-Z0-9]+)*(?:\-[a-zA-Z0-9]+)*)+)$
Description
An overly simple UNIX based path regex. The path must begin with a forward slash. The path segments may not lead or end with an underscore or dash which is a good thing. They also can not be doubled (__ or --). Another good thing. I've omitted all the punctuation that RFC allows until further notice.
Matches
/users/web/mysite/web/cgi-bin
Non-Matches
/users/web/my site/web/cgi-bin | users/web/mysite/web/cgi-bin/
Author Rating: Not yet rated. Ted Cambron
   Displaying page 1 of 1 pages; Items 1 to 5

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