173 regular expressions found in this category!
Displaying page
of
pages;
Items to
| Title |
Test
Details
Pattern Title
|
| Expression |
(\{\\f\d*)\\([^;]+;) |
| Description |
This pattern returns the font section from an RTF document. The first parenthetical subexpression captures the font number, the second returns the actual font enumeration. Lame-o, but fun! :-) |
| Matches |
{\f0\Some Font names here; | {\f1\fswiss\fcharset0\fprq2{\*\panose 020b0604020202020204}Arial; | {\f |
| Non-Matches |
{f0fs20 some text} |
| Author |
Rating:
Not yet rated.
Joel Dooris
|
| Title |
Test
Details
Pattern Title
|
| Expression |
(^\d{5}-\d{3}|^\d{2}.\d{3}-\d{3}|\d{8}) |
| Description |
Validar o do CEP Brasileiro com 8 posicoes podendo usar
mascara . e - ou somente numeros |
| Matches |
12.345-678 | 12345-678 | 12345678 |
| Non-Matches |
12.345678 | 12345-1 | 123 |
| Author |
Rating:
Not yet rated.
Fernando Cerqueira
|
| Title |
Test
Details
Pattern Title
|
| Expression |
^0[1-6]{1}(([0-9]{2}){4})|((\s[0-9]{2}){4})|((-[0-9]{2}){4})$ |
| Description |
Regular Expression that validate phone in France. |
| Matches |
01 46 70 89 12 | 01-46-70-89-12 | 0146708912 |
| Non-Matches |
01-46708912 | 01 46708912 | +33235256677 |
| Author |
Rating:
Not yet rated.
Bertrand Perrin
|
| Title |
Test
Details
Pattern Title
|
| Expression |
^<a\s+href\s*=\s*"http:\/\/([^"]*)"([^>]*)>(.*?(?=<\/a>))<\/a>$ |
| Description |
Regexp to find all external links in a HTML string.
Can easily be modified to handle all/other links/protocols (like file/https/ftp).
Uses lookahead assertions and non-greedy modifier to check for the end </a> but still allow html tags inbetween start and end A tag.
Takes into account that there could be linebreaks and other nasty whitespace chars in the middle of the tag.
I am using it to find all external links in embedded HTML code and change 1.the target of the link 2.insert a "Leaving Site" logo to illustrate you are leaving site. |
| Matches |
<a href="http://www.mysite.com">my external link</a> | <a href="http:/ |
| Non-Matches |
<a href="myinternalpage.html">my internal link</a> |
| Author |
Rating:
Not yet rated.
Anders Rask
|
| Title |
Test
Details
Pattern Title
|
| Expression |
^([0-1]([\s-./\\])?)?(\(?[2-9]\d{2}\)?|[2-9]\d{3})([\s-./\\])?([0-9]{3}([\s-./\\])?[0-9]{4}|[a-zA-Z0-9]{7}|([0-9]{3}[-][a-zA-Z0-9]{4})) |
| Description |
USA Alhpanumeric Valid Phone numbers |
| Matches |
1.222.333.1234 | 1-223-123-1232 | 1-888-425-DELL |
| Non-Matches |
1.1.123123.123 | 12-1322-112-31 | 1-800-CALL-DEL |
| Author |
Rating:
Not yet rated.
Amit Deshpande
|
| Title |
Test
Details
Pattern Title
|
| Expression |
((?<strElement>(^[A-Z0-9-;=]*:))(?<strValue>(.*))) |
| Description |
Usesful for importing vcards. Matches vcard elements and values. |
| Matches |
BEGIN: | TEL;WORK;VOICE: | TEL: |
| Non-Matches |
begin: | TEL;PREF; |
| Author |
Rating:
Not yet rated.
Karsten Grombach
|
| Title |
Test
Details
Pattern Title
|
| Expression |
^(\d{5}-\d{4}|\d{5})$ |
| Description |
this works with ASP.net regular expression valiadtors, ecma script compliant |
| Matches |
12345 | 12345-1234 |
| Non-Matches |
12345-12345 | 123 | 12345-abcd |
| Author |
Rating:
Not yet rated.
lynn eriksen
|
| Title |
Test
Details
Pattern Title
|
| Expression |
[A-Z][a-z]+ |
| Description |
This expression was developed to match the Title cased words within a Camel cased variable name. So it will match 'First' and 'Name' within 'strFirstName'. |
| Matches |
strFirstName | intAgeInYears | Where the Wild Things Are |
| Non-Matches |
123 | abc | this has no caps in it |
| Author |
Rating:
Not yet rated.
Steven Smith
|
| Title |
Test
Details
Pattern Title
|
| Expression |
([0-1][0-9]|2[0-3]):[0-5][0-9] |
| Description |
Validate an hour entry to be between 00:00 and 23:59 |
| Matches |
00:00 | 13:59 | 23:59 |
| Non-Matches |
24:00 | 23:60 |
| Author |
Rating:
Not yet rated.
Steve Charland
|
| Title |
Test
Details
Pattern Title
|
| Expression |
^([0-1]([\s-./\\])?)?(\(?[2-9]\d{2}\)?|[2-9]\d{3})([\s-./\\])?(\d{3}([\s-./\\])?\d{4}|[a-zA-Z0-9]{7})$ |
| Description |
It checks for Valid US Phone numbers.
Accepts &amp;amp;quot;.&amp;amp;quot;,Space,\,/,- as delim. |
| Matches |
1.222.333.1234 | 1-223-123-1232 | 12223334444 |
| Non-Matches |
1.1.123123.123 | 12-1322-112-31 | 11231321131 |
| Author |
Rating:
Not yet rated.
Amit Deshpande
|
| Title |
Test
Details
Pattern Title
|
| Expression |
(("|')[a-z0-9\/\.\?\=\&]*(\.htm|\.asp|\.php|\.jsp)[a-z0-9\/\.\?\=\&]*("|'))|(href=*?[a-z0-9\/\.\?\=\&"']*) |
| Description |
Will locate an URL in a webpage.
It'll search in 2 ways - first it will try to locate a href=, and then go to the end of the link. If there is nu href=, it will search for the end of the file instead (.asp, .htm and so on), and then take the data between the "xxxxxx" or 'xxxxxx' |
| Matches |
href="produktsida.asp?kategori2=218" | href="NuclearTesting.htm" |
| Non-Matches |
U Suck |
| Author |
Rating:
Not yet rated.
Henric Rosvall
|
| Title |
Test
Details
Pattern Title
|
| Expression |
^([A-Z]{1,2}[0-9]{1,2}|[A-Z]{3}|[A-Z]{1,2}[0-9][A-Z])( |-)[0-9][A-Z]{2} |
| Description |
Checks whether the string specified is in the same format as the UK postcode format defined on:
http://www.magma.ca/~djcl/postcd.txt
It allows:
A = Letter
N = Number
AN NAA, ANA NAA, ANN NAA, AAN NAA, AAA NAA (rare), AANN NAA, AANA NAA
It gives the option to have the two parts of the uk postcode to be separated by a space or a hyphen.
(restriction is set to all-capitals) |
| Matches |
AA11 1AA | AA1A 1AA | A11-1AA |
| Non-Matches |
111 AAA | 1AAA 1AA | A1AA 1AA |
| Author |
Rating:
Not yet rated.
Henk de Vries
|
| Title |
Test
Details
Pattern Title
|
| Expression |
@{2}((\S)+)@{2} |
| Description |
This will match results in a template situation. For example:
template reads
Dear @@Name@@,
....
would become
Dear John,
If you dont want to use the @@ change the @ to what ever characters you want.
|
| Matches |
@@test@@ | @@name@@ | @@2342@@ |
| Non-Matches |
@test@ | @@na me@@ | @@ name@@ |
| Author |
Rating:
Not yet rated.
john hamman
|
| Title |
Test
Details
Pattern Title
|
| Expression |
\({1}[0-9]{3}\){1}\-{1}[0-9]{3}\-{1}[0-9]{4} |
| Description |
|
| Matches |
(111)-111-1111 |
| Non-Matches |
11111111111 |
| Author |
Rating:
Not yet rated.
s4 s
|
| Title |
Test
Details
Pattern Title
|
| Expression |
<[^>\s]*\bauthor\b[^>]*> |
| Description |
This expression will match the corresponding XML/HTML elements opening and closing tags. Useful to handle documents fragments, without loading an XML DOM.
|
| Matches |
<author name="Daniel"> | </sch:author> | <pp:author name="Daniel" |
| Non-Matches |
<other> | </authors> | <work>author</work> |
| Author |
Rating:
Not yet rated.
Daniel Cazzulino
|
| Title |
Test
Details
Pattern Title
|
| Expression |
^([1-9]|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])$ |
| Description |
This validates a number between 1 and 255. Could be modified to IP, or just to verify a number in a range. |
| Matches |
1 | 108 | 255 |
| Non-Matches |
01 | 256 |
| Author |
Rating:
Not yet rated.
K Thompson
|
| Title |
Test
Details
Pattern Title
|
| Expression |
<[aA][ ]{0,}([a-zA-Z0-9"'_,.:;!?@$&()%=/ ]|[-]|[ \f]){0,}>((<(([a-zA-Z0-9"'_,.:;!?@$&()%=/ ]|[-]|[ \f]){0,})>([a-zA-Z0-9"'_,.:;!?@$&()%=/ ]|[-]|[ \f]){0,})|(([a-zA-Z0-9"'_,.:;!?@$&()%=/ ]|[-]|[ \f]){0,})){0,} |
| Description |
I wrote this sweet little (well, not so little really) reg to extract links from an HTML source.... it is very robust, give it a try.
The only limitation I have discovered is that it can't match invalid HTML... |
| Matches |
<a href='javascript:functionA();'><i>this text is italicized</i></a> |
| Non-Matches |
<A href='#'><P</A></P> |
| Author |
Rating:
Not yet rated.
Brian Webb
|
| Title |
Test
Details
Pattern Title
|
| Expression |
^[0-9A-Za-z_ ]+(.[jJ][pP][gG]|.[gG][iI][fF])$ |
| Description |
Matches HTML image leaf filenames. |
| Matches |
good.gif | go d.GIf | goo_d.jPg |
| Non-Matches |
junk | bad.bad.gif | slash\gif. |
| Author |
Rating:
Not yet rated.
Geoffrey Swenson
|
| 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?<\s?\/?[^\s>]+(\s+[^"'=]+(=("[^"]*")|('[^\']*')|([^\s"'>]*))?)*\s*\/?> |
| Description |
Matches tags |
| Matches |
<world www="hello" /> |
| Non-Matches |
<>>>world www="hello" /> |
| Author |
Rating:
Not yet rated.
Darren Neimke
|
Displaying page
of
pages;
Items to