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.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login