I have a JS function which is passed a string that a RegEx is run against, and returns any matches:
searchText= // some string which may or may not contain URLs
Rxp= new RegExp("([a-zA-Z\d]+://)?(\w+:\w+@)?([a-zA-Z\d.-]+\.[A-Za-z]{2,4})(:\d+)?(/.*)?/ig")
return searchText.match(Rxp);
The RegExp should return matches for any of the following (and similar derivations):
- google.com
- www.google.com
- http://www.google.com
- http://google.com
- google.com?querystring=value
- www.google.com?querystring=value
- http://www.google.com?querystring=value
- http://google.com?querystring=value
However, no such luck. Any suggestions?