I have a string like "test http://www.bing.com test"
. I want to extract just the url ("http://www.bing.com"
) from this string. How do I go about doing it? How would the regex look like?
Asked
Active
Viewed 1,592 times
-4
-
4And you really couldn't find a regex with a search for "regex match url" or something similar ? – adeneo Sep 02 '14 at 19:30
2 Answers
0

Federico Piazza
- 30,085
- 15
- 87
- 123
-
Thanks @Fede, i actually need a regex which would match without http as well. like just www.bing.com – AnoojNair Sep 02 '14 at 19:47
-
@AnoojNair Ok, you can use this one instead. I've updated the answer with it: http://regex101.com/r/uI3qL5/2 – Federico Piazza Sep 02 '14 at 19:49
0
There is a nice URl parsing plug-in for jQuery you can use that will clean up the source text a bit before doing it's job.

Lucky Edward
- 136
- 11