Regex for URL matching in JavaScript
Extracting URLs from text is a frequent need for scrapers and log parsers. This pattern matches http(s) links up to the first whitespace. Try your own inputs below.
/https?:\/\/[^\s/$.?#].[^\s]*/gTry it live
The pattern and sample strings below are pre-loaded. Edit anything, or describe a variation in plain English and generate your own.
/https?:\/\/[^\s/$.?#].[^\s]*/gvalid ✓One sample per line. Tested live on the JavaScript engine — other flavors are validated and flagged for differences, not executed.
No samples.