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

Please support RegExLib Sponsors

Sponsors

Expressions by User

Change page:   |    Displaying page 2 of 2 pages; Items 21 to 29
Title Test Details Subject or Title w/ Punctuation
Expression
^([^_][\w\d\@\-]+(?:s\'|\'[a-zA-Z]{1,2})?(?:\,)?(?: [\w\d\@\-]+(?:s\'|\'[a-zA-Z]{1,2})?(?:\,)?)*(?:\.|\!|\?){0,3}[^\s_])$
Description
Here's a regex for a title or subject line. The title (or subject) may contain basic punctuation and may not have leading or trailing spaces or underscores but that's about it.
Matches
Wow, what a day! | 100th Aniversary | This Works...
Non-Matches
!Wow,what a night | _begin_ | This ,wont work' either....
Author Rating: Not yet rated. tedcambron
Title Test Details Numbers
Expression
^((?:\+|\-|\$)?(?:\d+|\d{1,3}(?:\,\d{3})*)(?:\.\d+)?(?:[a-zA-Z]{2}|\%)?)$
Description
Here's another one for numbers. Any kind of number. Money $$$, percentage %, ect. Commas are optional and must be properly formatted.
Matches
$1,000,000.00 | 100% | 12345.67890
Non-Matches
$$10.00 | 10%% | 1234,5678, | 123.456.789
Author Rating: The rating for this expression. tedcambron
Title Test Details Domain URL
Expression
^(http\:\/\/(?:www\.)?[a-zA-Z0-9]+(?:(?:\-|_)[a-zA-Z0-9]+)*(?:\.[a-zA-Z0-9]+(?:(?:\-|_)[a-zA-Z0-9]+)*)*\.[a-zA-Z]{2,7}(?:\/)?)$
Description
A URL to a domain name. Only for HTTP but that can be easily changed to accept more. The dashes and underscores can only be used between text and/or digits. The slash on the end is optional. Unlike my other URL checkers this one does not allow query strings.
Matches
http://www.website.com/ | http://my-website.net | http://another_site.org
Non-Matches
www.website.com | http://_website.com | http://www. web--site.com
Author Rating: The rating for this expression. tedcambron
Title Test Details Randal L. Schwartz
Expression
^(Randal (?:L\.)? Schwartz|merlyn)$
Description
This regex looks for Randal.
Matches
Randal L. Schwartz | merlyn
Non-Matches
Randy Smith | Arthur
Author Rating: Not yet rated. tedcambron
Title Test Details URL Segments
Expression
(?:[a-zA-Z0-9]+(?:(?:_|\-|\.)[a-zA-Z0-9]+)*)
Description
This is an expression I sometimes use to verify segments in a URL or directory path. It must begin and end with a word character and may contain "_" "-" and "." one at a time. It's non-capturing as it sits. More restrictive than RFC2396 and used to prevent directory transversal holes.
Matches
abc-123 | abc.def.ghi | my_path
Non-Matches
_abc | abc..123 | -my_path
Author Rating: Not yet rated. tedcambron
Title Test Details Domain Name
Expression
(?:[^0-9][a-zA-Z0-9]+(?:(?:\-|\.)[a-zA-Z0-9]+)*)
Description
This is a little regex to verify domain style names per RFC952. This is also found in RFC1034 and both use the terms domain name and host name interchangeably even though I believe there may be a difference. Only alpha, digit, and dashes allowed with a dot as delimiter. Must begin with alpha and not end with a dash or dot. No spaces.
Matches
abc.123 | abc-xyz | my-name.for.me
Non-Matches
123.abc | abc- | abc..
Author Rating: Not yet rated. tedcambron
Title Test Details URL w/ Port Option
Expression
^(\w{3,6}\:\/\/[\w\-]+(?:\.[\w\-]+)+(?:\:\d{2,4})*(?:\/?|(?:\/[\w\-]+)*)(?:\/?|\/\w+\.\w{2,4}(?:\?[\w]+\=[\w\-]+)?)?(?:\&[\w]+\=[\w\-]+)*)$
Description
Here's my relaxed version of an URL regex. This one accepts just about anything but a double dot but still must resemble an URL to pass. Unlike my other URL validater this one accepts a port. Doesn't accept out of place meta characters.
Matches
http://domain.com/ | ftp://foo.bar/dir | https://me.us/file.pl?arg=1
Non-Matches
http://domain | ftp://foo.bar//dir | https://me.us/file..pl
Author Rating: The rating for this expression. tedcambron
Title Test Details Date Matching Regex
Expression
^\d?\d([./-])\d?\d\1(?:\d\d|\d{4})$
Description
Here's a super simple one for checking dates written numerically, MM/DD/YYYY. Separators can be "/", "-", or "." and must be the same. Because of it's simplicity it will allow dates that don't exist but that doesn't matter if you're looking for a basic date format checker and like to keep it simple.
Matches
1/2/14 | 01-02-2014 | 1.20.14
Non-Matches
1/2/014 | 1-2.2014 | Jan.2, 2014
Author Rating: Not yet rated. tedcambron
Title Test Details Another Date Matching Regex
Expression
^([a-yA-Y]{3,4}(?:\.?|[a-yA-Y]{1,6}?)\s?\d?\d(?:[d-tD-T]{2})?\,?\s?(?:\'?\d\d|\d{4}))$
Description
This will match things resembling a written date. It will match dates written incorrectly of course but this cute and funny date matching regex is for the beauty of the simplicity in checking the many ways to write a date.
Matches
Jan. 1, 2014 | January 1, '14 | JAN 1ST 2014
Non-Matches
this is not a date | 123 isn't either | neither is this!
Author Rating: Not yet rated. tedcambron
Change page:   |    Displaying page 2 of 2 pages; Items 21 to 29

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