Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jwdeane/249795 to your computer and use it in GitHub Desktop.
Save jwdeane/249795 to your computer and use it in GitHub Desktop.
Bookmarking Grubers handywork
(?x)
\b
( # Capture 1: entire matched URL
(?:
[\w-]+: # URL protocol and colon
(?:
/{1,3} # 1-3 slashes
| # or
[[:alpha:][:digit:]] # Single letter or digit
# (Try not to match, say "URI::Escape")
)
| # or
www\d?[.] # "www.", "www1.", "www2.", etc.
)
(?: # One or more:
[^\s()<>]+ # Run of non-space, non-()<>
| # or
\([^\s()<>]+\) # a matching set of parens
)+
(?: # End with:
\([^\s()<>]+\) # a set of parens
| # or
(?:
[^[:punct:]\s] # a non-punctuation non-space char
| # or
/ # a slash
)
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment