Skip to content

Instantly share code, notes, and snippets.

@edjw
Last active May 28, 2019 13:50
Show Gist options
  • Save edjw/82d2476c9304f797a69776bcdd0c22b3 to your computer and use it in GitHub Desktop.
Save edjw/82d2476c9304f797a69776bcdd0c22b3 to your computer and use it in GitHub Desktop.
Wrap bare urls in a:href or markdown link
HTML
Find: (http|ftp|https)://([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:/~+#-]*[\w@?^=%&/~+#-])?
Replace: <a href="$0">$0</a>
Markdown
Find: ((http|ftp|https)://([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:/~+#-]*[\w@?^=%&/~+#-])?)
Replace: [$1]($1)
@edjw
Copy link
Author

edjw commented Nov 28, 2018

Doesn't ignore urls that already wrapped by a:href

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment