173 regular expressions found in this category!
Displaying page
of
pages;
Items to
| Title |
Test
Details
Pattern Title
|
| Expression |
^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$ |
| Description |
This matches an IP address, putting each number in its own group that can be retrieved by number. If you do not care about capturing the numbers, then you can make this shorter by putting everything after ^ until immediately after the first \. in a group ( ) with a {3} after it. Then put the number matching regex in once more.
It only permits numbers in the range 0-255.
|
| Matches |
0.0.0.0 | 255.255.255.02 | 192.168.0.136 |
| Non-Matches |
256.1.3.4 | 023.44.33.22 | 10.57.98.23. |
| Author |
Rating:
Andrew Polshaw
|
| 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:
Fernando Cerqueira
|
| Title |
Test
Details
Pattern Title
|
| Expression |
(?s)(?:\e\[(?:(\d+);?)*([A-Za-z])(.*?))(?=\e\[|\z) |
| Description |
This expression will match all of the commands(escape codes) used in ANSI files. These are what were used to create the colors/blocks on BBS's for those of us that once dialed into them.
http://www.wikipedia.org/wiki/ANSI_escape_code has a reference for ANSI escape codes.
http://idledreams.net/lordscarlet/posts/153.aspx shows an example of the engine I have created surrounding the expression |
| Matches |
[32mHello | [1;35mTest | [2J |
| Non-Matches |
abc |
| Author |
Rating:
Doug Moore
|
| Title |
Test
Details
Pattern Title
|
| Expression |
\u00AE |
| Description |
Matches the registered trademark (®). Pretty simple, yet I dont think existed on RegExLib before. |
| Matches |
® |
| Non-Matches |
anything else |
| Author |
Rating:
Roman Lukyanenko
|
| Title |
Test
Details
Pattern Title
|
| Expression |
^([0-9]{2})?(\([0-9]{2})\)([0-9]{3}|[0-9]{4})-[0-9]{4}$ |
| Description |
A simple expression to brazilian phone number code, with international code.
Simple DDI without "+" 99 plus simple DDD (99) plus simple local phone number 3 or 4 digits plus "-" plus 4 digits. |
| Matches |
55(21)123-4567 | (11)1234-5678 | 55(71)4562-2234 |
| Non-Matches |
3434-3432 | 4(23)232-3232 | 55(2)232-232 |
| Author |
Rating:
Rafael Miranda
|
| Title |
Test
Details
Pattern Title
|
| Expression |
^(s-|S-){0,1}[0-9]{3}\s?[0-9]{2}$ |
| Description |
Validates swedish zipcodes (postnr) with or without space between groups. With leading s- or not. Can be disconnected by removing ''(s-|S-){0,1}''. |
| Matches |
12345 | 932 68 | S-621 46 |
| Non-Matches |
5367 | 425611 | 31 545 |
| Author |
Rating:
Tommy Ullberg
|
| 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:
Daniel Cazzulino
|
| Title |
Test
Details
Pattern Title
|
| Expression |
^[^']*$ |
| Description |
This one matches all strings that do not contain the single quotation mark ('). |
| Matches |
asljas | %/&89uhuhadjkh | "hi there!" |
| Non-Matches |
'hi there!' | It's 9 o'clock | ''''' |
| Author |
Rating:
Peter Friese
|
| Title |
Test
Details
Pattern Title
|
| Expression |
^[{|\(]?[0-9a-fA-F]{8}[-]?([0-9a-fA-F]{4}[-]?){3}[0-9a-fA-F]{12}[\)|}]?$ |
| Description |
Specifier Format of Guid Values that this RegEx supports: 32 digits: [xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx] 32 digits separated by hyphens: [xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx] 32 digits separated by hyphens, enclosed in brackets: [{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}] 32 digits separated by hyphens, enclosed in parentheses: [(xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)] |
| Matches |
914D226A-2F5B-4944-934D-96BBE6571977 | {914D226A-2F5B-4944-934D-96BBE6571977} |
| Non-Matches |
914D226A-2F5B-4944-XXXX-96BBE6571977 | {914D226A-2F5B-4944-XXXX-96BBE6571977} |
| Author |
Rating:
Nicholas Berardi
|
| Title |
Test
Details
Pattern Title
|
| Expression |
^[0-9]{4}\s{0,2}[a-zA-z]{2}$ |
| Description |
Dutch postalcode expression. 4 digits followed by max. two spaces end ending on two letters. |
| Matches |
4006 AB | 4006ab | 4006 AB |
| Non-Matches |
4006.ab | 4006_ab | 4006/ab |
| Author |
Rating:
martijn db
|
| Title |
Test
Details
Pattern Title
|
| Expression |
^\(?082|083|084|072\)?[\s-]?[\d]{3}[\s-]?[\d]{4}$ |
| Description |
I modified the existing phone number regex for another user looking to only allow 082, 083, 084, or 072 exchanges. Written by Jason Gaylord |
| Matches |
082-131-5555 | 083-145-654 | 072 555 1212 |
| Non-Matches |
131-253-4564 | 5551212 | 800 555 1212 |
| Author |
Rating:
Jason N. Gaylord
|
| Title |
Test
Details
Pattern Title
|
| Expression |
\d{2}.?\d{3}.?\d{3}/?\d{4}-?\d{2} |
| Description |
This regular expressions matches CNPJ number. CNPJ is a Registration Number of Brazilian Companies. |
| Matches |
00.000.000/0000-00 | 00000000000000 |
| Non-Matches |
00-000-000-000-00 | AA.AAA.AAA/AAAA-AA |
| Author |
Rating:
Gabriel Fróes
|
| Title |
Test
Details
Pattern Title
|
| Expression |
^\(?[\d]{3}\)?[\s-]?[\d]{3}[\s-]?[\d]{4}$ |
| Description |
This regular expression matches 10 digit US Phone numbers in different formats. Some examples are
1)area code in paranthesis.
2)space between different parts of the phone number.
3)no space between different parts of the number.
4)dashes between parts.
|
| Matches |
(573)8841878 | 573-884-1234 | 573 234 1256 |
| Non-Matches |
(573)(673)2345 | 573-12-2345 |
| Author |
Rating:
kode kode
|
| Title |
Test
Details
Pattern Title
|
| Expression |
(\s*\(?0\d{4}\)?\s*\d{6}\s*)|(\s*\(?0\d{3}\)?\s*\d{3}\s*\d{4}\s*) |
| Description |
UK Phone Number Allows leading and trailing spaces and optional spaces after the dialing code.
Initially the expression I posted was
\s*0\d{4}\s*\d{6}\s*|\s*0\d{3}\s*\d{7}\s*
But this didn't include optional brackets e.g. (01603) 123123 or phone numbers in a London format e.g. 0208 123 1234 |
| Matches |
01603 123123 | 0207 1234567 | (0208) 123 1234 |
| Non-Matches |
123 123132 |
| Author |
Rating:
Joe Gass
|
| Title |
Test
Details
Pattern Title
|
| Expression |
^(\{|\[|\().+(\}|\]|\)).+$ |
| Description |
Matches "clan" nicks/names. |
| Matches |
{CLaN}nick | [Clan]Nick | (Clan)Nick |
| Non-Matches |
Nick |
| Author |
Rating:
Jag fire
|
| Title |
Test
Details
Pattern Title
|
| Expression |
(at\s)(?<fullClassName>.+)(\.)(?<methodName>[^\.]*)(\()(?<parameters>[^\)]*)(\))((\sin\s)(?<fileName>.+)(:line )(?<lineNumber>[\d]*))? |
| Description |
Just a simple regExp to parse the stack trace. Developed when using the exception block from MS, coz they only showed the stack all bunched together. Could be used as follows:
[C#]
string regExParams = @"(at\s)(?<fullClassName>.+)(\.)(?<methodName>[^\.]*)(\()(?<parameters>[^\)]*)(\))((\sin\s)(?<fileName>.+)(:line )(?<lineNumber>[\d]*))?";
Regex re = new System.Text.RegularExpressions.Regex(regExParams,RegexOptions.Compiled);
MatchCollection mtc;
mtc = re.Matches(System.Environment.StackTrace);
foreach(Match mt in mtc)
{
MessageBox.Show(mt.Result("${fullClassName}"));
MessageBox.Show(mt.Result("${methodName}"));
MessageBox.Show(mt.Result("${parameters}"));
MessageBox.Show(mt.Result("${fileName}"));
MessageBox.Show(mt.Result("${lineNumber}"));
}
Seems to work well, but use at your own peril!!
Feel free to use and enhance (there's probably a lot that could be done, like getting parameters individually(?), etc) |
| Matches |
at System.IO.__Error.WinIOError(Int32 errorCode, String str) | at ExceptionManagementQuickStartSampl |
| Non-Matches |
ExceptionManagementQuickStartSamples.Form1.DoLogon(String userName, String password) in c:\program f |
| Author |
Rating:
Mike Stancombe
|
Displaying page
of
pages;
Items to