i
Hate
Regex
Library
Cheatsheet
Community
Open playground
match a valid url
Regex title
View-only original
Remix in playground
JavaScript
Expression
/
Regular expression
https
?
:
\/
\/
(
www
\.
)
?
[-a-zA-Z0-9@:%._\+~#=]
{1,256}
\.
[a-zA-Z0-9()]
{1,6}
\b
(
[-a-zA-Z0-9()!@:%_\+.~#?&\/\/=]
*
)
https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()!@:%_\+.~#?&\/\/=]*)
/
gm
g
global
i
ignore case
m
multiline
s
dot all
u
unicode
y
sticky
Test bench
Sample text
5 matches
abcdef www.whatever.com
https://github.com/geongeorge/i-hate-regex
https://www.facebook.com/
https://www.google.com/
https://xkcd.com/2293/
https://this-shouldn'
[email protected]
http://www.example.com/
abcdef www.whatever.com https://github.com/geongeorge/i-hate-regex https://www.facebook.com/ https://www.google.com/ https://xkcd.com/2293/ https://this-shouldn't.match@example.com http://www.example.com/
Structure
Railroad diagram
SVG
PNG
Embed
Live