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

Please support RegExLib Sponsors

Sponsors

Expressions by User

   Displaying page 1 of 1 pages; Items 1 to 3
Title Test Details Ultimate URL URN Regex
Expression
^((nntp|sftp|ftp(s)?|http(s)?|gopher|news|file|telnet):\/\/)?(([a-zA-Z0-9\._-]*([a-zA-Z0-9]\.[a-zA-Z0-9])[a-zA-Z]{1,6})|(([0-9]{1,3}\.){3}[0-9]{1,3}))(:\d+)?(\/[^:][^\s]*)?$
Description
Finally, an expression that can reliably match any valid URL/URN! Future proof against vanity TLDs, doesn't require a schema, can parse IPv4s with or without port, can parse regular URLs with/without port, can accept extra baggage at the end, and, with a slight modification (a la ^$ and changing the final rule around a bit) this can be used to find and activate URLs in bodies of text safely and reliably. Have fun (tell me if it could be improved)!
Matches
http://www.google.com/#sclient=psy&hl=en&q=this+is+a+google+serach+%5E((Csftp)%3A%2F%2F)%3F((%5Ba-zA-Z0-9%5C._-%5D%2B%5C.%5Ba-zA-Z%5D%7B2%2C7%7D)%7C((%5B0-9%5D%7B1%2C3%7D%5C.)%7B3%7D%5B0-9%5D%7B1%2C3%7D))(%3A%5Cd%2B)%3F(%2F%5Ba-zA-Z0-9%5C%26amp%3B%25_%5C.%2F-~-%23%5D*)%3F%24&aq=f&aqi=&aql=&oq=&gs_rfai=&pbx=1&fp=ca05a7bb65e82229 | http://192.168.1.1:5649
Non-Matches
htttp://google.com | http://google-.com | http://google.123 | http://google.commmmmm | http://123.456.789.1231
Author Rating: The rating for this expression. Xunnamius
Title Test Details Ultimate Name Regex
Expression
^\s*([A-Za-z]{2,4}\.?\s*)?(['\-A-Za-z]+\s*){1,2}([A-Za-z]+\.?\s*)?(['\-A-Za-z]+\s*){1,2}(([jJsSrR]{2}\.)|([XIV]{1,6}))?\s*$
Description
Match to just about any valid human name you could think of.
Matches
Dr. Tre-Tre Morgan V. Copperstone Mc'Giles Jr. | Tre Giles
Non-Matches
@#$#
Author Rating: The rating for this expression. Xunnamius
Title Test Details Ultimate Phone Number Regex (international + USA)
Expression
^((\+)?[1-9]{1,4})?([-\s\.\/])?((\(\d{1,4}\))|\d{1,4})(([-\s\.\/])?[0-9]{1,6}){2,6}(\s?(ext|x)\s?[0-9]{1,6})?$
Description
After searching for one, I just said "screw it" and wrote my own, and here she is. A regular expression to match against phone numbers, both international and USA! Very VERY flexible, if I do say so myself (and I do).
Matches
555-955-5555 | 5555555555 | +1(773).9554-8946 | +1-(773)+95548946 ext 8875 | 1/(773)/9554/8946x563 | (00)7-901-759-92-61ext15
Non-Matches
$%^&* (of course not)
Author Rating: The rating for this expression. Xunnamius
   Displaying page 1 of 1 pages; Items 1 to 3

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