Example: "My site is http://www.abcd.com, and yours is http://www.def.ghi/jkl. Is Fred's https://www.xyz.com? Or is it http://www.xxx.com?abc=def? (I thought his site was http://www.mmm.com), but clearly it's not."
This should extract
http://www.abcd.com http://www.def.ghi/jkl https://www.xyz.com http://www.xxx.com?abc=def http://www.mmm.com
Notes: it should assume that any punctuation following the url is NOT part of the url, e.g. the comma after http://www.abcd.com, is not part of the url. This includes trailing question marks, which I realize in actuality COULD be part of the url. Of course, if a question mark is followed by querystring data, it SHOULD be considered part of the url. Note that urls might be followed by multiple punctuation marks, as in the the case of (Is your url http://abcd.com)?
Urls (and their trailing punctuation, if any) will always be followed by a space, a newline/return character -- or they'll be the end of the string being tested.
The will be preceded by a whitespace character or, possibly, an open bracket or parenthesis, as in "Please visit my site (http://www.abcd.com)." Or they'll come at the beginning of the string.
This regexp should work for http, https and ftp.
This is for an Actionscript project. I believe that Actionscript uses the same regular-expression engine as Javascript.
Thanks!