I tried to search for every word that has
bar-foo and switch them to foo-bar
so I wrote on the find (\w+)-(\w+)
and on the replace $2-$1
and instead of writing foo-bar it wrote $2-$1.
Yes, Regular Expression in search mode is on.
It seems that the Replace Regex doesn't work and been taken literally
A normal “Find and Replace” can't do that, but it's possible with “Regular Expressions”. In Notepad++ press Ctr+H to open the “Find and Replace” window. Under Search Mode: choose “Regular expression” and then check the “matches newline” checkbox. You should see closing </p> tags at the end of each line.
Using Regex to find and replace text in Notepad++ And also ensure the 'Regular expression' radio button is set. Check that your word wrap is switched off so that you actually see the text get modified. In this example we just replace the match with empty text.
Replacing text within NotepadOpen the text file in Notepad. Click Edit on the menu bar, then select Replace in the Edit menu. Once in the Search and Replace window, enter the text you want to find and the text you want to use as a replacement.
With notepad++ you'll need to use \2-\1
as the replacement string.
Sources :
Mark's Speechblog
Use \2 \1
in the replace field.
Notepad++ uses the linux like \1 syntax instead of $1
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