Displaying page
of
pages;
Items to
| Title |
Test
Details
Pattern Title
|
| Expression |
^([A-PR-UWYZ0-9][A-HK-Y0-9][AEHMNPRTVXY0-9]?[ABEHMNPRVWXY0-9]? {1,2}[0-9][ABD-HJLN-UW-Z]{2}|GIR 0AA)$ |
| Description |
Regular expression to match valid UK postcodes.
In the UK postal system not all letters are used in all positions (the same with vehicle registration plates) and there are various rules to govern this. This regex takes into account those rules.
Details of the rules:
First half of postcode
Valid formats
[A-Z][A-Z][0-9][A-Z]
[A-Z][A-Z][0-9][0-9]
[A-Z][0-9][0-9]
[A-Z][A-Z][0-9]
[A-Z][A-Z][A-Z]
[A-Z][0-9][A-Z]
[A-Z][0-9]
Exceptions
Position - First.
Contraint - QVX not used
Position - Second.
Contraint - IJZ not used except in GIR 0AA
Position - Third.
Constraint - AEHMNPRTVXY only used
Position - Forth.
Contraint - ABEHMNPRVWXY
Second half of postcode
Valid formats
[0-9][A-Z][A-Z]
Exceptions
Position - Second and Third.
Contraint - CIKMOV not used
|
| Matches |
DN3 6GB | SW42 4RG | GIR 0AA |
| Non-Matches |
SEW4 5TY | AA2C 4FG | AA2 4CV |
| Author |
Rating:
Not yet rated.
Stuart Wade
|
| Title |
Test
Details
Pattern Title
|
| Expression |
^[\w-]+(\.[\w-]+)*@([a-z0-9-]+(\.[a-z0-9-]+)*?\.[a-z]{2,6}|(\d{1,3}\.){3}\d{1,3})(:\d{4})?$ |
| Description |
Matches a valid email address including ip's which are rarely used. Allows for a-z0-9_.- in the username, but not ending in a full stop i.e [email protected] is invalid and a-z0-9- as the optional sub domain(s) with domain name and a 2-7 char (a-z) tld allowing for short tld's like ca and new ones like museum. |
| Matches |
|
| Non-Matches |
|
| Author |
Rating:
Not yet rated.
nick bennett
|
| Title |
Test
Details
Pattern Title
|
| Expression |
^([a-zA-Z.\s']{1,50})$ |
| Description |
This is just a regular special char expression used to get the hax0rs off your back (hopefully). You can use this for regular open name checking if you wanted. It only fails on the insert of anything other than a-z, A-Z, and ' or whitespace. I'm open to suggestions, but try to email them to me as well as posting them to help others. Thanks. |
| Matches |
Jon M. Doe | Tim L. O'Doul | ...''''' |
| Non-Matches |
Doe, Jon | <>,;:"?/ | %\$#@! |
| Author |
Rating:
John Smart
|
| Title |
Test
Details
Pattern Title
|
| Expression |
^([a-zA-Z0-9!@#$%^&*()-_=+;:'"|~`<>?/{}]{1,5})$ |
| Description |
This Regular expression validates a string that contains all printable characters with a minimum length of 1 and maximum length of 5.
Obviously the min and max can be changed to meet the users needs.
^([a-zA-Z0-9!@#$%^&*()-_=+;:'"|~`<>?/{}]{1,5})$ This is the string, I keep getting &amp;lt and other characters when I save it. |
| Matches |
ilove | $%*!_ | it |
| Non-Matches |
123456 | This is great |
| Author |
Rating:
Not yet rated.
Michael Matusiewicz
|
| Title |
Test
Details
Pattern Title
|
| Expression |
^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,6}$ |
| Description |
Checks domain names. This validates domains based on latest specifications (RFCs 952 and 1123 dealing with hostnames and RFC 1035 dealing with domain name system requirements) except that it only includes realistic fully-qualified domains: 1. requires at least one subdomain 2. allows shortest top-level domains like "ca", and "museum" as longest.
Other validation rules: 1. Labels/parts should be seperated by period. 2. Each label/part has maximum of 63 characters. 3. First and last character of label must be alphanumeric, other characters alphanumeric or hyphen. 4. Does not check maxlength of domain which incidentally is 253 characters of text (255 binary representation).
For a regular expression that matches ALL domains:
^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)*[a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?$
|
| Matches |
regexlib.com | this.is.a.museum | 3com.com |
| Non-Matches |
notadomain-.com | helloworld.c | .oops.org |
| Author |
Rating:
Remi Sabourin
|
| Title |
Test
Details
Pattern Title
|
| Expression |
(\w(\s)?)+ |
| Description |
Used to verify that the string consists of only A-z, 0 - 9 and underscore. Several words allowed, only one space between them. No spaces up front. Hey, I know it's easy, but it was not in the library! Plus, the test option here is not working well all the time. |
| Matches |
Test | TesT | tesT9 _test9 |
| Non-Matches |
\\\ |
| Author |
Rating:
Not yet rated.
Alsu Fifty
|
| Title |
Test
Details
Pattern Title
|
| Expression |
^[a-zA-Z0-9_\s-]+$ |
| Description |
This tests an input string for only a-z and A-Z and only allows underscores, hyphens and spaces. The purpose is to force users to generate legitimate, readable file names that can be streamed from the web. |
| Matches |
123Testing | 123_Testing | 123-Testing This |
| Non-Matches |
!@#Testing | Testing "This" | Don't Forget to Write |
| Author |
Rating:
Paul Fox
|
| Title |
Test
Details
Pattern Title
|
| Expression |
^((?:(?:(?:[a-zA-Z0-9][\.\-\+_]?)*)[a-zA-Z0-9])+)\@((?:(?:(?:[a-zA-Z0-9][\.\-_]?){0,62})[a-zA-Z0-9])+)\.([a-zA-Z0-9]{2,6})$ |
| Description |
Captures Submatches, problem:domainname length can be longer than 64 chars, because every [a-zA-Z0-9][\.\-_] is only countet as one char. |
| Matches |
|
| Non-Matches |
|
| Author |
Rating:
Sebastian Hiller
|
| Title |
Test
Details
UK Domain Names
|
| Expression |
^(([a-z][0-9])|([0-9][a-z])|([a-z0-9][a-z0-9\-]{1,2}[a-z0-9])|([a-z0-9][a-z0-9\-](([a-z0-9\-][a-z0-9])|([a-z0-9][a-z0-9\-]))[a-z0-9\-]*[a-z0-9]))\.(co|me|org|ltd|plc|net|sch|ac|mod|nhs|police|gov)\.uk$ |
| Description |
UK domain names. Includes the following restrictions from Nominet as at time of posting:
1.Only a-z, 0-9 and hyphen may be used.
2.First or last character may not be a hyphen.
3.Third and fourth characters may not both be hyphens.
4.Third level domain may not be a single character.
5.Third level domain may not be two letters or two numbers.
6.Third level domain may be one letter and one number.
This does not yet include the following restrictions:
1.Whole domain may not be longer than 64 characters in length.
2.Third level domain may not duplicate any top/second level domain. |
| Matches |
zeropanic.co.uk | z2.co.uk | 1-1.org.uk |
| Non-Matches |
zeropanic.com | z.co.uk | zz.co.uk |
| Author |
Rating:
Not yet rated.
Amos Hurd
|
| Title |
Test
Details
Pattern Title
|
| Expression |
^([A-Z]|[a-z]|[0-9])(([A-Z])*(([a-z])*([0-9])*(%)*(&)*(')*(\+)*(-)*(@)*(_)*(\.)*)|(\ )[^ ])+$ |
| Description |
will match as long as the only chars exist in the string : A-Z,a-z,0-9,'Space' chr(32),%&'+-@_.
It's useful for check vs Account Names where you might want to forbid entering other chars then what is in the pattern. also will not allow repeated space in the string |
| Matches |
|
| Non-Matches |
!MYACCOUNT! | {Superman} | $ Money Man $ |
| Author |
Rating:
g y
|
| Title |
Test
Details
Pattern Title
|
| Expression |
^\\([^\\]+\\)*[^\/:*?"<>|]?$ |
| Description |
Orginally on this site search for Path, go to next page
you see a reg expression for ^([a-zA-Z]\:|\\)\\([^\\]+\\)*[^\/:*?"<>|]+\.htm(l)?$
which I modified with this one to disallow drive specification. |
| Matches |
\temp\ | \temp\content\ | \Program Files\ |
| Non-Matches |
a:\Temp\ | \Temp\Content | c:\Program Files\ |
| Author |
Rating:
Rod DeValcourt
|
| Title |
Test
Details
Pattern Title
|
| Expression |
(((file|gopher|news|nntp|telnet|http|ftp|https|ftps|sftp)://)|(www\.))+(([a-zA-Z0-9\._-]+\.[a-zA-Z]{2,6})|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}))(/[a-zA-Z0-9\&%_\./-~-]*)? |
| Description |
You can use this regular expression in your PHP scripts to convert entered URL in text to URL link. Example:
$text=ereg_replace("(((file|gopher|news|nntp|telnet|http|ftp|https|ftps|sftp)://)|(www\.))+(([a-zA-Z0-9\._-]+\.[a-zA-Z]{2,6})|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}))(/[a-zA-Z0-9\&%_\./-~-]*)?","<a href=\"./redir.php?url=\\0\" target=\"_blank\">\\0</a>",$text); |
| Matches |
http://diskusneforum.sk | www.diskusneforum.sk | ftp://123.123.123.123/ |
| Non-Matches |
diskusneforum.sk |
| Author |
Rating:
Martin Ille
|
| Title |
Test
Details
Pattern Title
|
| Expression |
^((?<DRIVE>[a-z]:)|(\\\\(?<SERVER>[0-9]*[a-z\-][a-z0-9\-]*)\\(?<VOLUME>[^\.\x01-\x1F\\""\*\?<>:|\\/][^\x01-\x1F\\""\*\?|><:\\/]*)))?(?<FOLDERS>(?<FOLDER1>(\.|(\.\.)|([^\.\x01-\x1F\\""\*\?|><:\\/][^\x01-\x1F\\""\*\?<>:|\\/]*)))?(?<FOLDERm>[\\/](\.|(\.\.)|([^\.\x01-\x1F\\""\*\?|><:\\/][^\x01-\x1F\\""\*\?<>:|\\/]*)))*)?[\\/]?$ |
| Description |
Verify "well formed-ness" of DOS or UNC paths.
Passed over 170 NUnit test, (took 3 complete rewrites)
Components of a path:
DRIVE:=[a-z]:
SERVER:=[0-9]*[a-z\-][a-z0-9\-]*
FNAME:=[^\.\x01-\x1F\\""\*\?<>:|\\/][^\x01-\x1F\\""\*\?<>:|\\/]*
VOLUME:=FNAME
UNC:=\\SERVER\VOLUME
ROOT:=(DRIVE|UNC)
FOLDER:=.|..|FNAME
FOLDERS:=FOLDER?([\]FOLDER)*[\]?
PATH:=^ROOT?FOLDERS?$ |
| Matches |
his is a very 'long' folder\that is.part of 2 folders. | b\c\..\x. | \\Dads\Mp3\FileName1\.\TestDir2 |
| Non-Matches |
\\1.dads\C | \. folder\ | .ext |
| Author |
Rating:
Not yet rated.
Tristen Fielding
|
| Title |
Test
Details
Pattern Title
|
| Expression |
^[ .a-zA-Z0-9:-]{1,150}$ |
| Description |
Belgian Carenet message Alphanumerical field - as described in the 'programmer's guide for carenet - Belgacom'.
Only the following characters, ASCII, are authorised:
Space . - :
Alphanumerical characters (a-z and A-Z)
Numerical characters (0-9)
Length is restricted to 150 chars |
| Matches |
This is a test. | This. is - a test:. | This is 123 test. |
| Non-Matches |
This / is a test? | This is a test* |
| Author |
Rating:
Not yet rated.
bart coelus
|
| Title |
Test
Details
Pattern Title
|
| Expression |
^(([A-Za-z]+[^0-9]*)([0-9]+[^\W]*)([\W]+[\W0-9A-Za-z]*))|(([A-Za-z]+[^\W]*)([\W]+[^0-9]*)([0-9]+[\W0-9A-Za-z]*))|(([\W]+[^A-Za-z]*)([A-Za-z]+[^0-9]*)([0-9]+[\W0-9A-Za-z]*))|(([\W]+[^0-9]*)([0-9]+[^A-Za-z]*)([A-Za-z]+[\W0-9A-Za-z]*))|(([0-9]+[^A-Za-z]*)([A-Za-z]+[^\W]*)([\W]+[\W0-9A-Za-z]*))|(([0-9]+[^\W]*)([\W]+[^A-Za-z]*)([A-Za-z]+[\W0-9A-Za-z]*))$ |
| Description |
Password with minimum 1 Letter (A-Za-z), 1 Number (0-9) and Special Character (\W). It doesn't matter the charaters position. See the Mathching Examples.
Question? Write an Email to me. |
| Matches |
test22!! | !!test22 | 22!!test |
| Non-Matches |
test22 | !!test | 22!! |
| Author |
Rating:
Andreas Feiden
|
| Title |
Test
Details
Pattern Title
|
| Expression |
(?=^.{1,254}$)(^(?:[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9]\.?)+(?:[a-zA-Z]{2,})$) |
| Description |
Based on Remi Sabourin pattern. Adds total length validation. Like Remi's this allows a part to be all numbers. To prevent all numbers just add (?!\d+\.) between (^(?: and ([a-z-A-Z0-9] |
| Matches |
host.domain-name.com | 33.domain.com | 3-3.domain.com |
| Non-Matches |
_host.domain.com | [host].domain.com | host.domain.33 |
| Author |
Rating:
Not yet rated.
Scott Mulcahy
|
| Title |
Test
Details
File Path
|
| Expression |
^(([a-zA-Z]\:)|(\\))(\\{1}|((\\{1})[^\\]([^/:*?<>"|]*))+)$ |
| Description |
Checks for a valid Filepath, either located on a local drive or a UNC share on the network. Use the following string to include the regex within a XML defintion file: RegEx="^([a-zA-Z]\:)|(\\)(\\{1}|((\\{1})[^\\]([^/:*?<>"|]*(?<!\[\])))+)$"/> (encode the appropiate HTML characters like <,>," with the appropiate HTML codes < = (ampersand)lt; > = (ampersand)gt; " = (ampersand)quote; |
| Matches |
C:\SomeFilePatt|\\SomeServer\SomeShare |
| Non-Matches |
C:|\SomeServer |
| Author |
Rating:
Not yet rated.
Jens K. Suessmeyer
|
| Title |
Test
Details
Strong Password
|
| Expression |
^(?=(.*[a-z]){1,})(?=(.*[\d]){1,})(?=(.*[\W]){1,})(?!.*\s).{7,30}$ |
| Description |
The basic expression requires at least 1 lower case, 1 upper case, 1 numeric, 1 non-word and no whitespace.
<br /><br />
The format of the expression lends itself to being parameterised, thus in C# I have a method that returns a modified pattern based on passed in parameters e.g.
<br /><br />return "^(?=(.*[a-z]){" + minLowerCase.ToString() + ",})"<br /> + "(?=(.*[\d]){" + minNumeric.ToString() + ",})"<br /> ... <br /> + ".{" + minLength.ToString() + "," + maxLength.ToString() + "}$");<br /><br />Its then possible to set the password strength via configuration files which require strong passwords in production environments, but allow weaker passwords in development environments. |
| Matches |
qW1@xxx |
| Non-Matches |
qwerty123 |
| Author |
Rating:
Not yet rated.
Chris Stead
|
| Title |
Test
Details
Simple but affective
|
| Expression |
[\s0-9a-zA-Z\;\"\,\<\>\\?\+\=\)\(\\*\&\%\\$\#\.]* |
| Description |
[\s0-9a-zA-Z\;\"\,]* match any text just add character or symbol to be matched inside[ ] like [\<] for (<) symbol. if u want find between two word then just use Eg : <div>[\s0-9a-zA-Z\;\"\,]* </div> it will return the content between <div> tags. Just add all format to match all .It is better than (.*) because (.*) is difficult to end at particular part as we needed. |
| Matches |
any between given two words |
| Non-Matches |
not check for new line ...etc .i think it work... |
| Author |
Rating:
sail
|
| Title |
Test
Details
UK Vehicle Registration Numbers (VRM)
|
| Expression |
Pattern that matches all DVLA Vehicle Registration Marks (VRM). Allows for an optional single space between segments.
Source:
http://www.carreg.co.uk/number_plates/registration_numbers |
| Description |
^(([A-Z]{1,2}[ ]?[0-9]{1,4})|([A-Z]{3}[ ]?[0-9]{1,3})|([0-9]{1,3}[ ]?[A-Z]{3})|([0-9]{1,4}[ ]?[A-Z]{1,2})|([A-Z]{3}[ ]?[0-9]{1,3}[ ]?[A-Z])|([A-Z][ ]?[0-9]{1,3}[ ]?[A-Z]{3})|([A-Z]{2}[ ]?[0-9]{2}[ ]?[A-Z]{3})|([A-Z]{3}[ ]?[0-9]{4}))$ |
| Matches |
A1|R296ACR|JON 123|SU 51 ANE |
| Non-Matches |
BAZ |
| Author |
Rating:
Not yet rated.
John Bayly
|
Displaying page
of
pages;
Items to