I currently have a usecase on which I want to match all http://
and https://
strings in a text but only when they do not start with a "
or '
using JavaScript.
If they start with another character, e.g., a whitespace, I still only want to match the http://
or https://
without the preceding character.
My current regex uses a negative lookbehind but I just realized that this is not supported in Safari:
/(?<!["'])(https?:\/\/)/gm
So what would be an alternative for using a negative lookbehind to match the following strings in a text:
http://
-> should matchhttp://
https://
-> should matchhttps://
xhttps://
-> should matchhttps://
wherebyx
can be any character except"
and'
"https://
-> should NOT match at all