Regex replacement not working
-
I’ve checked the following regex string against a number of regex syntax checkers and it’s valid:
<img src="([A-Za-z0-9-_\.%]*)" alt="([A-Za-z0-9-_\.]*)"(\s)*\/>
(I’ve also tried the alternative where the double-quotes are escaped:
<img src=\"([A-Za-z0-9-_\.%]*)\" alt=\"([A-Za-z0-9-_\.]*)\"(\s)*\/>However, neither of these work for me in Notepad++ regex:

Any help on the valid syntax for Notepad++ appreciated (what flavour of regex does it use?
P.
-
@Paul-Moloney said in Regex replacement not working:
Any help on the valid syntax for Notepad++ appreciated (what flavour of regex does it use?
The docs explain Notepad++ uses the Boost regular expression library (v1.70).
But in every regex version I’ve used,
[A-Za-z0-9-_\.%]would cause problems; in general, hyphens mean “range” inside a character class, unless they are escaped or the last character in the class. So[0-9-]is okay,[0-9-_]is not, but[0-9_-]is (non-range hyphen last) and[0-9\-_]is.