javascript - Backreference in Regex -
so, have javascript regexp this:
/url:.?(['"])(https?:\/\/.*?)\1/
i use find specific url inside html/js code. can see capture link inside either ''
or ""
. problem, because don't want links 'http://'.
/url:.?(['"])(https?:\/\/.+)\1/
this picks stuff 'http://"+d+', bad.
i'd able in regex this:
/(['"])(https?:\/\/[^\1]+)\1/
to use [^\1] instead of dot, whatever inside '' or "", making sure not pick 'http://"+d+'
is there way stuff this?
Comments
Post a Comment