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 1
Title Test Details Pattern Title
Expression
\b(((\S+)?)(@|mailto\:|(news|(ht|f)tp(s?))\://)\S+)\b
Description
Whilst writing a plain-text to HTML function, I ran into the problem of links that users had written with <a> tags (as opposed to just writing the URL) were linking improperly. This regular expression returns many types of URL, and preceding characters, if any. This allows you to handle each type of match appropriately
Matches
href='http://www.deepart.org' | [email protected] | ftp://123.123.123.123
Non-Matches
www.deepart.org | deepart.org | 123.123.123.123
Author Rating: Not yet rated. Demo Gorgon
   Displaying page 1 of 1 pages; Items 1 to 1

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