RegExLib.com - The first Regular Expression Library on the Web!

Please support RegExLib Sponsors

Sponsors

Advanced Search

Keywords

Category

Minimum Rating

Results per Page

Search Results: 132 regular expressions found.

Change page:   |    Displaying page 1 of 7 pages; Items 1 to 20
Title Test Details Pattern Title
Expression
^\d{3}-\d{2}-\d{4}$
Description
This regular expression will match a hyphen-separated Social Security Number (SSN) in the format NNN-NN-NNNN.
Matches
333-22-4444 | 123-45-6789
Non-Matches
123456789 | SSN
Author Rating: The rating for this expression. Steven Smith
Title Test Details Pattern Title
Expression
^(user=([a-z0-9]+,)*(([a-z0-9]+){1});)?(group=([a-z0-9]+,)*(([a-z0-9]+){1});)?(level=[0-9]+;)?$
Description
This re was used for a security routine. The format is: [user=name1,name2,...,nameN;][group=group1,group2,...,groupN;][level=number;] Each component is optional, but they must appear the in order listed if applicable.
Matches
user=foo,bar,quux;group=manager,admin;level=100; | group=nobody;level=24;
Non-Matches
user=foo | blahh
Author Rating: Not yet rated. Michael Scovetta
Title Test Details Pattern Title
Expression
^(?=[^&])(?:(?<scheme>[^:/?#]+):)?(?://(?<authority>[^/?#]*))?(?<path>[^?#]*)(?:\?(?<query>[^#]*))?(?:#(?<fragment>.*))?
Description
Use it for breaking-down a URI (URL, URN) reference into its main components: Scheme, Authority, Path, Query and Fragment. This is not a simple match regular expression. so it not works to verify a URI. It returns 1 matching group for each URI component. For example, for the following URI: http://regexlib.com/REDetails.aspx?regexp_id=x#Details returns: scheme=&quot;http&quot;, authority=&quot;regexlib.com&quot;, path=&quot;/REDetails.aspx&quot;, query=&quot;regexp_id=x&quot; and fragment=&quot;Details&quot;. This is a W3C raccomandation (RFC 2396).
Matches
http://regexlib.com/REDetails.aspx?regexp_id=x#Details
Non-Matches
&
Author Rating: Not yet rated. Frederico Knabben
Title Test Details Text Extension
Expression
^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w ]*))+\.(txt|TXT)$
Description
This RE validates a path/file of type txt (text file) This RE can be used as a filter on certain file types, while insuring the entire string is a fully qualified path and file. The filter value can be changed or added to as you need
Matches
c:\file.txt | c:\folder\sub folder\file.txt | \\network\folder\file.txt
Non-Matches
C: | C:\file.xls | folder.txt
Author Rating: Not yet rated. Michael Ash
Title Test Details Pattern Title
Expression
^[\w-]+(?:\.[\w-]+)*@(?:[\w-]+\.)+[a-zA-Z]{2,7}$
Description
Matches 99.99% of e-mail addresses (excludes IP e-mails, which are rarely used). The {2,7} at the end leaves space for top level domains as short as .ca but leaves room for new ones like .museum, etc. The ?: notation is a perl non-capturing notation, and can be removed safely for non-perl-compatible languages. See also email.
Matches
Non-Matches
Author Rating: The rating for this expression. J. Washam
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: The rating for this expression. Andrew Polshaw
Title Test Details Pattern Title
Expression
(^|\s)(00[1-9]|0[1-9]0|0[1-9][1-9]|[1-6]\d{2}|7[0-6]\d|77[0-2])(-?|[\. ])([1-9]0|0[1-9]|[1-9][1-9])\3(\d{3}[1-9]|[1-9]\d{3}|\d[1-9]\d{2}|\d{2}[1-9]\d)($|\s|[;:,!\.\?])
Description
Incorporated other people's examples; removed extraneous parenthesis on 10/7/04. Currently the SSA site says 772 is the highest AREA number generated (http://www.ssa.gov/employer/highgroup.txt). Old expression was: (^|\s)\d{3}(-?|[\. ])\d{2}\2\d{4}($|\s|[;:,!\.\?]). Looks for either the beginning of a line or whitespace before the beginning of the social security number, then either zero or one hyphen OR one of a period or space, then uses the \3 to reference the value returned in the parenthesis that includes the -?|[\. ] (basically says if the first dash, period, or space is there, then the second one is required; and if the first dash, period, or space is not there, then the second one can't be either), and finally looks for the end of a line, whitespace, or punctuation characters after the social security number.
Matches
123-45-6789 | 123 45 6789 | 123456789
Non-Matches
12345-67-890123 | 1234-56-7890 | 123-45-78901
Author Rating: The rating for this expression. Dennis Flynn
Title Test Details Pattern Title
Expression
(\w[-._\w]*\w@\w[-._\w]*\w\.\w{2,3})
Description
This is my all-time favourite e-mail validator. I've used it for years and it's never failed me :-)
Matches
Non-Matches
Author Rating: The rating for this expression. Darren Neimke
Title Test Details Pattern Title
Expression
^(?=((0[1-9]0)|([1-7][1-7]\d)|(00[1-9])|(0[1-9][1-9]))-(?=(([1-9]0)|(0[1-9])|([1-9][1-9]))-(?=((\d{3}[1-9])$|([1-9]\d{3})$|(\d[1-9]\d{2})$|(\d{2}[1-9]\d)$))))
Description
I wrote this regular expression because a project I was working on required a stricter validator on social security numbers. There are actually gov't standards on what is a valid social: The first 3 digits can't be &gt; 779, The first 3 digits can't be 000, The second 2 digits can't be 00, and the last 4 digits can't be 0000. This regex handles all these cases and checks formatting for numbering and dashes (###-##-####)
Matches
053-27-0293 | 770-29-2012 | 063-71-9123
Non-Matches
780-20-1230 | 000-24-1290 | 123-00-1239
Author Rating: Not yet rated. Scott Long
Title Test Details Pattern Title
Expression
(\[(\w+)\s*(([\w]*)=('|&quot;)?([a-zA-Z0-9|:|\/|=|-|.|\?|&amp;]*)(\5)?)*\])([a-zA-Z0-9|:|\/|=|-|.|\?|&amp;|\s]+)(\[\/\2\])
Description
Peseudo-HTML code matcher. Allows for one parameter within the first tag (name is optional), the value of which can be optionally delimited by either double or single quotes. Uses backreferencing to ensure that the end and start tags match, and that any single or double quotes match. Very useful for web forums or any situation where users may be prompted to enter text for display on a webpage somewhere, as it can be quickly processed into HTML without allowing HTML to be specified within the input itself (which may pose a security risk).
Matches
[link url=&quot;http://www.domain.com/file.extension?getvar=value&amp;secondvar=value&quot;]Link[/li
Non-Matches
[a]whatever[/b] | [a var1=something var2=somethingelse]whatever[/a] | [a]whatever[a]
Author Rating: Not yet rated. Simon Christensen
Title Test Details Social Security Number
Expression
^(?!000)([0-6]\d{2}|7([0-6]\d|7[012]))([ -]?)(?!00)\d\d\3(?!0000)\d{4}$
Description
This regex validates U.S. social security numbers, within the range of numbers that have been currently allocated.
Matches
078-05-1120 | 078 05 1120 | 078051120
Non-Matches
987-65-4320 | 000-00-0000 | (555) 555-5555
Author Rating: The rating for this expression. Michael Ash
Title Test Details Pattern Title
Expression
^(?!000)(?!666)(?<SSN3>[0-6]\d{2}|7(?:[0-6]\d|7[012]))([- ]?)(?!00)(?<SSN2>\d\d)\1(?!0000)(?<SSN4>\d{4})$
Description
Updated on 3/4/2004 per feedback to additionally exclude SSNs that begin with 666 which, as reported, are also not valid. Regular expression for validating US Social Security Numbers. Accepts optional hyphens or spaces as formatting characters. Parses the three subfields of the SSN into three named sub-strings (SSN1, SSN2, and SSN3) to facilitate program use. Rejects matches on all zeros for any individual subfield of the Social Security Number. Matches only on those SSNs that fall within the range of numbers currently allocated by the Social Security Administration.
Matches
111223333 | 111-22-3333 | 111 22 3333
Non-Matches
111003333 | 111 22-3333 | 666-22-3333
Author Rating: Not yet rated. Jerry Schmersahl
Title Test Details UK Domain Names with Protocol and Port
Expression
^(ht|f)tp((?<=http)s)?://((?<=http://)www|(?<=https://)www|(?<=ftp://)ftp)\.(([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(:\d+)?\/?$
Description
UK http/https/ftp URI. Based on my previous expression, this one takes an optional port number and optional trailing slash.
Matches
http://www.zeropanic.co.uk/ | http://www.zeropanic.co.uk:81/ | http://www.zeropanic.co.uk:81
Non-Matches
http://www.zeropanic.com:81/
Author Rating: Not yet rated. Amos Hurd
Title Test Details Pattern Title
Expression
^(?!000)([0-6]\d{2}|7([0-6]\d|7[012])) ([ -])? (?!00)\d\d([ -|])? (?!0000)\d{4}$
Description
U.S. social security numbers (SSN), within the range of numbers that have been currently allocated. Matches the pattern AAA-GG-SSSS, AAA GG SSSS, AAA-GG SSSS, AAA GG-SSSS, AAAGGSSSS, AAA-GGSSSS, AAAGG-SSSS, AAAGG SSSS or AAA GGSSSS. All zero in any one field is not allowed. ** Additionally, spaces and/or dashes and/or nothing are allowed. In Michael Ash's example 123-45 6789 and 123456789 would fail there was a '\3' after the second octet of numbers that seemed to confuse the regex. now any combination of spaces, dashes, or nothing will work between the SSN octets. BoxerX.com thanks Michael for the regex!
Matches
145470191 | 145 47 0191 | 145-47 0191
Non-Matches
000470191 | 145-00-0191 | 145.47.0191
Author Rating: The rating for this expression. Joe Johnston
Title Test Details Pattern Title
Expression
^((\d(\x20)\d{2}(\x20)\d{2}(\x20)\d{2}(\x20)\d{3}(\x20)\d{3}((\x20)\d{2}|))|(\d\d{2}\d{2}\d{2}\d{3}\d{3}(\d{2}|)))$
Description
It is an expression to valide a french num&#233;ro de s&#233;curit&#233; social (social security number translate is not sure) with or without the key.
Matches
181049520156962 | 1 81 04 95 201 569 62 | 1 81 04 95 201 569
Non-Matches
1 81049520156962 | 181049520156962fds | 1810495201569ds
Author Rating: Not yet rated. krest krest
Title Test Details Pattern Title
Expression
^(?:[a-zA-Z0-9_'^&amp;/+-])+(?:\.(?:[a-zA-Z0-9_'^&amp;/+-])+)*@(?:(?:\[?(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))\.){3}(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\]?)|(?:[a-zA-Z0-9-]+\.)+(?:[a-zA-Z]){2,}\.?)$
Description
this will validate most legal email addresses, even allows for some discouraged but perfectly legal characters in local part; allows IP domains with optional []; keeps final tld at a minmum of 2 chars; non capturing groups for efficiency
Matches
[email protected] | [email protected]. | me@[24.111.232.1]
Non-Matches
[email protected] | [email protected] | test_case@here*555%there.com
Author Rating: Not yet rated. Micah Duke
Title Test Details Pattern Title
Expression
(?&lt;HTML&gt;&lt;a[^&gt;]*href\s*=\s*[\&quot;\']?(?&lt;HRef&gt;[^&quot;'&gt;\s]*)[\&quot;\']?[^&gt;]*&gt;(?&lt;Title&gt;[^&lt;]+|.*?)?&lt;/a\s*&gt;)
Description
Powerful href extractor for HTML Element A. Groups extracted result separately that you can easily use HTML Element, URI or its title. These may be useful to: (?&lt;HTML&gt;&lt;area[^&gt;]*href\s*=\s*[\&quot;\']?(?&lt;HRef&gt;[^&quot;'&gt;\s]*)[\&quot;\']?[^&gt;]*&gt;) (?&lt;HTML&gt;&lt;form[^&gt;]*action\s*=\s*[\&quot;\']?(?&lt;HRef&gt;[^&quot;'&gt;\s]*)[\&quot;\']?[^&gt;]*&gt;) (?&lt;HTML&gt;&lt;frame[^&gt;]*scr\s*=\s*[\&quot;\']?(?&lt;HRef&gt;[^&quot;'&gt;\s]*)[\&quot;\']?[^&gt;]*&gt;) (?&lt;HTML&gt;&lt;iframe[^&gt;]*scr\s*=\s*[\&quot;\']?(?&lt;HRef&gt;[^&quot;'&gt;\s]*)[\&quot;\']?[^&gt;]*&gt;) (?&lt;HTML&gt;&lt;link[^&gt;]*href\s*=\s*[\&quot;\']?(?&lt;HRef&gt;[^&quot;'&gt;\s]*)[\&quot;\']?[^&gt;]*&gt;)
Matches
&lt;a href='http://www.regexlib.com'&gt;Text&lt;/a&gt; | &lt;a href=&quot;...'&gt;Text&lt;/a&gt; | &
Non-Matches
all other html tags
Author Rating: Not yet rated. Aivar Holyfield
Title Test Details Pattern Title
Expression
\b((?#optional port)(https?|ftp|file)://)? (?#sub domain)([a-z0-9](?:[-a-z0-9]*[a-z0-9])?\.)+ (?#top domain)(com\b|edu\b|biz\b|gov\b|in(?:t|fo)\b|mil\b|net\b|org\b|[a-z][a-z]\b) (?#optional port)(:\d+)? (?#optional path)(/[-a-z0-9_:\@&amp;?=+,.!/~*'%\$]*)* (?#not ending in)(?&lt;![.,?!]) (?#not enclosed in)(?!((?!(?:&lt;a )).)*?(?:&lt;/a&gt;)) (?#or enclosed in)(?!((?!(?:&lt;!--)).)*?(?:--&gt;))
Description
Yet Another URL Search. Useful for capturing URLs in raw text. Ignores URLs in HREF and comments. Turn off whitespacing to test!
Matches
http://www.google.com | google.com | http://some-domain.net/very/long/path/123.html
Non-Matches
subdomain.NonExistentTopDomain | &lt;a href=&quot;http://www.google.com&quot;&gt;www.google.com&lt;/
Author Rating: Not yet rated. Simon Ferguson
Title Test Details Pattern Title
Expression
(?=^.{1,254}$)(^(?:(?!\d+\.)[a-zA-Z0-9_\-]{1,63}\.?)+(?:[a-zA-Z]{2,})$)
Description
Validates MS FQDNs. 1) Entire fqdn less than 255 chars. 2) Host and domain names may contain an underscore. 3) 1st char can be a number. 4) No part can be all numbers. 5) Allows any TLD Works in C#. Based on Remi Sabourin's regex
Matches
host.domain.com | _host.domain.com | 1host-2._ldap.domain.com
Non-Matches
33.domain.com | host..com | this_really_long._fully_qualified_domain_name._contains_257_characters_w
Author Rating: Not yet rated. Scott Mulcahy
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
Change page:   |    Displaying page 1 of 7 pages; Items 1 to 20

Copyright © 2001-2024, RegexAdvice.com | ASP.NET Tutorials