I'm trying to get notepad++ to regex find all instances of "abc" and "def" in the following sentence:
The abc went to the def.
None of the following syntaxes seem to work:
NOTE: "[a|d]" matches any instance of "a" or "d" when I tested
Using Regex to find and replace text in Notepad++ In all examples, use select Find and Replace (Ctrl + H) to replace all the matches with the desired string or (no string). And also ensure the 'Regular expression' radio button is set.
A pipe symbol allows regular expression components to be logically ORed. For example, the following regular expression matches lines that start with the word "Germany" or the word "Netherlands". Note that parentheses are used to group the two expressive components.
FYI Notepad++ supports “PCRE” (i.e. PERL Compatible Regular Expressions) using Boost's RegEx library which is different from the PCRE and PCRE2 libraries.
It's nothing special about "longer than one character", Notepad++ doesn't support the | character in regex. Not even "a|d" works. See the regex help page. Version 6.1.1 of Notepad++ now supports |
.
I'd suggest using an editor with a proper regex implementation like gvim or UltraEdit.
Upgrade to Notepad++ v6. From the changelog: "PCRE (Perl Compatible Regular Expressions) is supported." I've verified that | works in regex search when using Notepad++ v6.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With