Displaying page
of
pages;
Items to
|
Title |
Test
Details
URL Validator
|
|
Expression |
^(http\:\/\/[a-zA-Z0-9_\-]+(?:\.[a-zA-Z0-9_\-]+)*\.[a-zA-Z]{2,4}(?:\/[a-zA-Z0-9_]+)*(?:\/[a-zA-Z0-9_]+\.[a-zA-Z]{2,4}(?:\?[a-zA-Z0-9_]+\=[a-zA-Z0-9_]+)?)?(?:\&[a-zA-Z0-9_]+\=[a-zA-Z0-9_]+)*)$
|
|
Description |
A simple but powerful URL validating regex. Will only accept hyper text transfer protocol (http) but can be easily changed to accept others. Accepts multiple subdomains and subdirectories. Even accept query strings.
|
|
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:
Ted Cambron
|
|
Title |
Test
Details
Email Validator
|
|
Expression |
^([a-zA-Z0-9]+[a-zA-Z0-9._%-]*@(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,4})$
|
|
Description |
After reading RFC2822 (then taking two asprin) I've come to the conclusion that I will not allow all RFC compliant email addresses to be entered at the forms on my site and will never have an issue with it. I re-enabled this regex, with a little user suggested edit, because I demand a stricter tolerance for my website than RFC allows. If you're like me and only want to allow minimal characters, then use this regex. Also, I've never met anyone who would submit an email address taking full advantage of RFC2822's allowances nor would I care to accomodate one who would.
|
|
Matches |
name@email.com
|
|
Non-Matches |
name@something.email.com
|
|
Author |
Rating:
Ted Cambron
|
|
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:
Ted Cambron
|
|
Title |
Test
Details
Query String Regex
|
|
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:
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:
Ted Cambron
|
|
Title |
Test
Details
Basic Name or Title
|
|
Expression |
^([a-zA-Z0-9]+(?: [a-zA-Z0-9]+)*)$
|
|
Description |
This is a very basic regex for a simple name or title. It must begin and end with a word character and may contain spaces. No punctuation :(
|
|
Matches |
My Category
|
|
Non-Matches |
any nonword character and leading/trailing spaces
|
|
Author |
Rating:
Ted Cambron
|
|
Title |
Test
Details
RFC Compliant Path
|
|
Expression |
^(/(?:(?:(?:(?:[a-zA-Z0-9\\-_.!~*'():\@&=+\$,]+|(?:%[a-fA-F0-9][a-fA-F0-9]))*)(?:;(?:(?:[a-zA-Z0-9\\-_.!~*'():\@&=+\$,]+|(?:%[a-fA-F0-9][a-fA-F0-9]))*))*)(?:/(?:(?:(?:[a-zA-Z0-9\\-_.!~*'():\@&=+\$,]+|(?:%[a-fA-F0-9][a-fA-F0-9]))*)(?:;(?:(?:[a-zA-Z0-9\\-_.!~*'():\@&=+\$,]+|(?:%[a-fA-F0-9][a-fA-F0-9]))*))*))*))$
|
|
Description |
After reading RFC2396 and researching it a little more I put together this regex rather than update my non-compliant, overly simple one. More specificaly an absolute path.
|
|
Matches |
All RFC2396 compliant paths
|
|
Non-Matches |
A non-RFC2396 compliant path
|
|
Author |
Rating:
Ted Cambron
|
|
Title |
Test
Details
US Phone Number
|
|
Expression |
^(1?(?: |\-|\.)?(?:\(\d{3}\)|\d{3})(?: |\-|\.)?\d{3}(?: |\-|\.)?\d{4})$
|
|
Description |
This is my simple phone number regex. There are many like it but this is mine. It accepts the most common United States phone number formats that normal people use. The number 1 at the beginning is optional and so is the separators. The separators can be a dash (-), a period (.) or a space. Putting the area code in parenthesis is also an option. That's about it.
|
|
Matches |
1-234-567-8910 | (123) 456-7891 | 123.456.7891 | 12345678910
|
|
Non-Matches |
12-345-678-9101 | 123-45678 | 123456789101
|
|
Author |
Rating:
Ted Cambron
|
|
Title |
Test
Details
US Zip Code
|
|
Expression |
^(\d{5}(?:\-\d{4})?)$
|
|
Description |
Just for UZ zip codes. The post office number is optional.
|
|
Matches |
12345 | 12345-6789
|
|
Non-Matches |
1234 | 123456 | 12345-123 | 12345-12345
|
|
Author |
Rating:
Ted Cambron
|
|
Title |
Test
Details
Social Security Number
|
|
Expression |
^(00[1-9]|0[1-9][0-9]|[1-6][0-9][0-9]|7[0-6][0-9]|77[0-2]\-\d{2}\-\d{4})$
|
|
Description |
A properly formatted US social security number. first three digits must be 001 - 772.
|
|
Matches |
123-45-6789
|
|
Non-Matches |
123456789 | 1234-56-7890 | 123-456-7890 | 123-45-67890
|
|
Author |
Rating:
Ted Cambron
|
|
Title |
Test
Details
Date
|
|
Expression |
^(\d{4}(?:(?:(?:\-)?(?:00[1-9]|0[1-9][0-9]|[1-2][0-9][0-9]|3[0-5][0-9]|36[0-6]))?|(?:(?:\-)?(?:1[0-2]|0[1-9]))?|(?:(?:\-)?(?:1[0-2]|0[1-9])(?:\-)?(?:0[1-9]|[12][0-9]|3[01]))?|(?:(?:\-)?W(?:0[1-9]|[1-4][0-9]5[0-3]))?|(?:(?:\-)?W(?:0[1-9]|[1-4][0-9]5[0-3])(?:\-)?[1-7])?)?)$
|
|
Description |
This is a regular expression to check for a properly formatted date according to the international date and time notation ISO 8601. See ISO 8601 specification for more information.
|
|
Matches |
ISO 8601 date format
|
|
Non-Matches |
non-ISO date format
|
|
Author |
Rating:
Ted Cambron
|
|
Title |
Test
Details
Time
|
|
Expression |
^([0-2][0-4](?:(?:(?::)?[0-5][0-9])?|(?:(?::)?[0-5][0-9](?::)?[0-5][0-9](?:\.[0-9]+)?)?)?)$
|
|
Description |
This is a regular expression to check for a properly formatted time according to the international date and time notation ISO 8601. See ISO 8601 specification for more information.
|
|
Matches |
24 | 24:00 | 23:59:59 | 235959
|
|
Non-Matches |
25 | 24:60
|
|
Author |
Rating:
Ted Cambron
|
|
Title |
Test
Details
Class A Network Number
|
|
Expression |
^(10\.[0-9]|[1-9][0-9]|[1-2][0-5][0-5]\.[0-9]|[1-9][0-9]|[1-2][0-5][0-5]\.[0-9]|[1-9][0-9]|[1-2][0-5][0-5])$
|
|
Description |
The IANA resrved 24-bit block of IP address space for private internets. It's just a single class A network number. This is also RFC 1918 compliant.
|
|
Matches |
10.0.0.0 | 10.255.255.255
|
|
Non-Matches |
17.16.0.0 | 192.168.255.255
|
|
Author |
Rating:
Ted Cambron
|
|
Title |
Test
Details
Class B Network Numbers
|
|
Expression |
^(172\.1[6-9]|2[0-9]|3[0-1|\.[0-9]|[1-9][0-9]|[1-2][0-5][0-5]\.[0-9]|[1-9][0-9]|[1-2][0-5][0-5])$
|
|
Description |
This is a set of 16 contiguous class B network numbers or a 16-bit block of ip address space as reserved by the IANA. RFC 1918 compliant.
|
|
Matches |
172.16.0.0 | 172.31.255.255
|
|
Non-Matches |
10.0.0.0 | 10.255.255.255 | 192.168.0.0 | 192.168.255.255
|
|
Author |
Rating:
Ted Cambron
|
|
Title |
Test
Details
Class C Network Numbers
|
|
Expression |
^(192\.168\.[0-9]|[1-9][0-9]|[1-2][0-5][0-5]\.[0-9]|[1-9][0-9]|[1-2][0-5][0-5])$
|
|
Description |
This is the 16-bit block of the IP address space for private internets reserved by the IANA. A set of 256 contiguous class C network numbers per RFC 1918.
|
|
Matches |
192.168.0.0 | 192.168.255.255
|
|
Non-Matches |
10.0.0.0 | 172.31.255.255
|
|
Author |
Rating:
Ted Cambron
|
|
Title |
Test
Details
Punctuation
|
|
Expression |
^((\'|\")?[a-zA-Z]+(?:\-[a-zA-Z]+)?(?:s\'|\'[a-zA-Z]{1,2})?(?:(?:(?:\,|\.|\!|\?)?(?:\2)?)|(?:(?:\2)?(?:\,|\.|\!|\?)?))(?: (\'|\")?[a-zA-Z]+(?:\-[a-zA-Z]+)?(?:s\'|\'[a-zA-Z]{1,2})?(?:(?:(?:\,|\.|\!|\?)?(?:\2|\3)?)|(?:(?:\2|\3)?(?:\,|\.|\!|\?)?)))*)$
|
|
Description |
This is a little goofy regex to allow punctuation. I was reluctant to post it but what the heck. If it puts a smile on somebody's face then it was worth it. It sort of works. :)
|
|
Matches |
"hello!" | "hello again"! | I'm back
|
|
Non-Matches |
hello" | "hello again!"! | I'mnot back
|
|
Author |
Rating:
Ted Cambron
|
|
Title |
Test
Details
Embedded YouTube Video
|
|
Expression |
(\"http:\/\/www\.youtube\.com\/v\/\w{11}\&rel\=1\")
|
|
Description |
A simple regex to validate an embedded YouTube video.
|
|
Matches |
a valid embedded YouTube video
|
|
Non-Matches |
anything else
|
|
Author |
Rating:
Ted Cambron
|
|
Title |
Test
Details
Embedded Google Video
|
|
Expression |
(\"http:\/\/video\.google\.com\/googleplayer\.swf\?docId=\d{19}\&hl=[a-z]{2}\")
|
|
Description |
A simple regex for validating an embedded Google video.
|
|
Matches |
an embedded Google video
|
|
Non-Matches |
anything else
|
|
Author |
Rating:
Ted Cambron
|
|
Title |
Test
Details
Password
|
|
Expression |
^([a-zA-Z0-9]{4,18}?)$
|
|
Description |
My simple but effective password regex. The password can only contain letters and/or digits and must be at least 6 characters long and no more than 20. I know it says {4,18} but it just works out that way. The question mark was added for optimization. Also, the password can not begin or end with a space or underscore.
|
|
Matches |
abc123
|
|
Non-Matches |
_abc123_
|
|
Author |
Rating:
Ted Cambron
|
|
Title |
Test
Details
Person's Name
|
|
Expression |
^([a-zA-Z]+(?:\.)?(?: [a-zA-Z]+(?:\.)?)*)$
|
|
Description |
Here's a regex for a person's name. Simple but effective.
|
|
Matches |
Mr. John Doe III | Billy B. Bob Jr.
|
|
Non-Matches |
@$%&?
|
|
Author |
Rating:
Ted Cambron
|
|
Title |
Test
Details
Title
|
|
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. The title 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:
Ted Cambron
|
|
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:
Ted Cambron
|
|
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,4}(?:\/)?)$
|
|
Description |
A URL to a domain name. Only for http but that can be changed easily to accept more. the dashes and undescores can only be used between text and/or digits. The slash on the end is optional
|
|
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:
Ted Cambron
|
|
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:
Ted Cambron
|
Displaying page
of
pages;
Items to