Skip to content

Instantly share code, notes, and snippets.

@tmitz
Last active December 28, 2015 23:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tmitz/7578177 to your computer and use it in GitHub Desktop.
Save tmitz/7578177 to your computer and use it in GitHub Desktop.
my $regex = qr/
\A
(
[a-z][a-z0-9+\-.]*:
(
\/\/
([a-z0-9\-._~%!$&'()*+,;=]+@)?
([a-z0-9\-._~%]+
|\[[a-f0-9:.]+\]
|\[v[a-f0-9][a-z0-9\-._~%!$&'()*+,;=:]+\])
(:[0-9]+)?
(\/[a-z0-9\-._~%!$&'()*+,;=:@]+)*\/?
|
(\/?[a-z0-9\-._~%!$&'()*+,;=:@]+(\/[a-z0-9\-._~%!\$&'()*+,;=:@]+)*\/?)?
)
|
(
[a-z0-9\-._~%!$&'()*+,;=@]+(\/[a-z0-9\-._~%!\$&'()*+,;=:@]+)*\/?
|
(\/[a-z0-9\-._~%!$&'()*+,;=:@]+)+\/?
)
)
(\?[a-z0-9\-._~%!$&'()*+,;=:@\/?]*)?
(\#[a-z0-9\-._~%!$&'()*+,;=:@\/?]*)?
\Z
/x;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment