Doesn’t that exclude things like ‘ target = “_blank”‘ and ” target = ‘_blank'”? I would suggest the regex /target\s*=\s*[\x22\x27]_blank[\x22\x27]\s*/. Though the correct way might be /target\s*=\s*([\x22\x27])_blank\1\s*/ but I am less sure about using backreferences outside of perl.
2 Comments
guyblade
Doesn’t that exclude things like ‘ target = “_blank”‘ and ” target = ‘_blank'”? I would suggest the regex /target\s*=\s*[\x22\x27]_blank[\x22\x27]\s*/. Though the correct way might be /target\s*=\s*([\x22\x27])_blank\1\s*/ but I am less sure about using backreferences outside of perl.
Lissa
Yeah, it does exclude those, but I had a cheat: the code was all written in-house by my team, so I knew that 99.95% of the cases would be regular.
Plus, backreferences frighten me a bit. It’s my shameful secret. 😛