BuildUtilities

Regex to Extract URLs from Text

Find every http/https URL inside a paragraph.

Input

https?:\/\/[\w.\-/?=&%#]+

Output

Matches against:
"See https://buildutilities.com and http://example.org/docs?id=1 for more."
→ https://buildutilities.com
→ http://example.org/docs?id=1

How it works

Greedy character class captures the full URL until whitespace or punctuation. Use the global flag (g) to extract all matches.

Try it yourself

Open the full Regex Tester to run this example on your own data.

Open Regex Tester
Tip Jar