Woshiadai Dev Notebook

March 29, 2008

Regex for javascript to detect a URL

Filed under: Uncategorized

var regex = /\b([\d\w\.\/\+\-\?\:]*)((ht|f)tp(s|)\:\/\/|[\d\d\d|\d\d]\.[\d\d\d|\d\d]
\.|www\.|\.tv|\.ac|\.com|\.edu|\.gov|\.int|\.mil|\.net|\.org|\.biz|\.info|\.name|\.pro
|\.museum|\.co)([\d\w\.\/\%\+\-\=\&\?\:\\\"\'\,\|\~\;]*)\b/gi;

 

Online tester for javascript regex:

http://www.regular-expressions.info/javascriptexample.html

Short tutorial for regex in javascript:

http://www.regular-expressions.info/javascript.html

Comments »

The URI to TrackBack this entry is: http://woshiadai.blogsome.com/2008/03/29/regex-for-javascript-to-detect-a-url/trackback/

No comments yet.

RSS feed for comments on this post.

Leave a comment

Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>























Get free blog up and running in minutes with Blogsome
Theme designed by Ben de Groot