Displaying page
of
pages;
Items to
Title |
Test
Details
URL Validator
|
Expression |
^(http(?:s)?\:\/\/[a-zA-Z0-9]+(?:(?:\.|\-)[a-zA-Z0-9]+)+(?:\:\d+)?(?:\/[\w\-]+)*(?:\/?|\/\w+\.[a-zA-Z]{2,4}(?:\?[\w]+\=[\w\-]+)?)?(?:\&[\w]+\=[\w\-]+)*)$
|
Description |
A simple but powerful URL validating regex. Accepts multiple sub-domains and sub-directories. Even accept query strings.
Now accept ports! Accepts HTTP or HTTPS.
Also accepts optional "/" on end of address.
|
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:
tedcambron
|
Title |
Test
Details
Email Validator
|
Expression |
^([a-zA-Z0-9]+(?:[.-]?[a-zA-Z0-9]+)*@[a-zA-Z0-9]+(?:[.-]?[a-zA-Z0-9]+)*\.[a-zA-Z]{2,7})$
|
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 in the forms on my website and will never have an issue with it. I demand a stricter tolerance for my website than RFC allows. If you're like me and only want to allow 99% of those email addresses entered into web-forms then use this little gem of an email checking 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 accommodate one who would.
|
Matches |
|
Non-Matches |
|
Author |
Rating:
tedcambron
|
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
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:
tedcambron
|
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:
tedcambron
|
Title |
Test
Details
Basic Subject or Title
|
Expression |
^([a-zA-Z0-9]+(?: [a-zA-Z0-9]+)*)$
|
Description |
This is a very basic regex for a simple subject 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:
tedcambron
|
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 to use for verifying a path rather than my non-compliant, safer, overly simple one. More specifically an absolute path.
|
Matches |
All RFC2396 compliant paths
|
Non-Matches |
A non-RFC2396 compliant path
|
Author |
Rating:
Not yet rated.
tedcambron
|
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:
tedcambron
|
Title |
Test
Details
US Zip Code
|
Expression |
^(\d{5}(?:\-\d{4})?)$
|
Description |
Just for US zip codes. Very simple but effective regex for verifying a number that resembles a zip code. The post office number is optional.
|
Matches |
12345 | 12345-6789
|
Non-Matches |
1234 | 123456 | 12345-123 | 12345-12345
|
Author |
Rating:
tedcambron
|
Title |
Test
Details
Social Security Number
|
Expression |
^(?!000)(?!666)(?!9)\d{3}([- ]?)(?!00)\d{2}\1(?!0000)\d{4}$
|
Description |
Updated SSN regex. A very simple one for verifying a properly formatted US social security number. First three digits must be 001 - 899 and not 666. Disallows all zeros in a group.
|
Matches |
123-45-6789
|
Non-Matches |
123-45 6789 | 1234-56-7890 | 123-00-7890
|
Author |
Rating:
tedcambron
|
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. Remember, this is just for the date. See ISO 8601 specification for more information.
|
Matches |
ISO 8601 date format
|
Non-Matches |
non-ISO date format
|
Author |
Rating:
tedcambron
|
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:
tedcambron
|
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:
Not yet rated.
tedcambron
|
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:
Not yet rated.
tedcambron
|
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:
Not yet rated.
tedcambron
|
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 works in most cases. :)
|
Matches |
"hello!" | "hello again"! | I'm back
|
Non-Matches |
hello" | "hello again!"! | I'mnot back
|
Author |
Rating:
tedcambron
|
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:
tedcambron
|
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:
tedcambron
|
Title |
Test
Details
Password
|
Expression |
^([a-zA-Z0-9]{6,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 {6,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:
tedcambron
|
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. O'Donnell III | Billy B. Bob Jr.
|
Non-Matches |
@$%&? | 0'Donnell
|
Author |
Rating:
tedcambron
|
Displaying page
of
pages;
Items to