views:

53

answers:

3
Eg: Google site http://www.google.com 

output: http://www.google.com


Eg: Yahoo site www.yahoo.com 

output: www.yahoo.com
+1  A: 

I think this tutorial:

http://java-programming.suite101.com/article.cfm/how_to_get_url_parts_in_javascript

should answer your questions and provide some code examples.

Hope that helps!

Mark Mayo
eg: some text some text http://abc.com some text testoutput: http://abc.com
yes, that should do it, look at the section on splitting and rebuilding URLs.
Mark Mayo
A: 

Split the string where there is a space and identify the segments that are URLs using regular expressions.

http://stackoverflow.com/questions/206059/php-validation-regex-for-url

Simon Brown
Your link is for a php solution.
fudgey
...but contains a regular expression.
Simon Brown
You do realize that php and javascript use different "flavors" of regex? http://www.regular-expressions.info/refflavors.html
fudgey
A: 

Check out this Answer.

fudgey