i found a regex that look for matching url here : http://daringfireball.net/2010/07/improved_regex_for_matching_urls, the regex is :
(?i)\b((?:https?://|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))
but when i try to use it in my js file firebug shows me SyntaxError: syntax error exactly in this part (?i)
i use the regex like the following :
text = $('textarea').val();
url_regex = (?i)\b((?:https?://|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]));
match = url_regex.exec(text);
where is the problem please ?
/characters to tell Javascript it's a regex./../-- see developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/…