A really loose regex for matching URLs
Not recommended for validating URLs, but it will find them. The g flag is JavaScript specific and indicates that the matching should be global.
/http:\/\/[\-\.\/\w]{1,256}(|\/)/gi
Not recommended for validating URLs, but it will find them. The g flag is JavaScript specific and indicates that the matching should be global.
/http:\/\/[\-\.\/\w]{1,256}(|\/)/gi
Might want to account for https:
/(http|https):\/\/[\-\.\/\w]{1,256}(|\/)/gi
Yes. I also left out FTP and most other protocols too. That was deliberate. This was a quick-and-dirty RegEx that I used for a specific purpose. I published it here because I wanted to save it somewhere and remember where I saved it.