regex and newlines
John Sampson last edited by
I wanted to rename a number of files using a batch file in a command-line app. To begin, I wanted to change each line to “ren \1 \1” so that I could work on it. However, Notepad++ included newlines so that it changed each line to “ren \1” on one line, “\1” on a new line. I could not work out how to prevent this, so I tried the same procedure in Sublime Text where it worked as I wanted it to work.
PeterJones last edited by PeterJones
I believe that capture group 1 included the newline. Since you only showed us your REPLACE, without showing the FIND, I cannot show you specifically what’s wrong with your FIND that puts the newline in group 1
Terry R last edited by
However, Notepad++ included newlines so that it changed each line to “ren \1” on one line, “\1” on a new line
So if you were using
\1that assumes you were searching in regular expression mode. Then I’m going to assume your find what field also captured the CR and LF characters which are EOL markers. Returning those would likely produce the result you saw.
I think you need to post the Find What field you used so we can confirm what you were doing.
Oh, just saw that @peterjones also believes the same.