0

I'm using this regex for finding URLs to make them clickable links with html:

((http|ftp|https):\/\/[\w-]+(\.[\w-]+)+([\w.,@?^=%&:\/~+#-]*[\w@?^=%&\/~+#-])?)

Unfortunately this will also work if a link is already hyperlinked like this:

<a href="https://www.example.com">My hyperlink</a>

My idea is to make the regex only work if there is no " in front of https (or http or ftp).

I tried to add ^(?!\".*$) in front of the pattern but it's not working.

How can I do that?

David
  • 2,898
  • 3
  • 21
  • 57

0 Answers0