It's a well known bug inherited from Scintilla, so it can't easily be fixed. The FAQ I mentioned in that original thread, now at http://notepad-plus.wiki.sourceforge.net/FindReplaceNewlineHowTo , explains all the workarounds I know of. I would forget trying to do it with regex.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Wait a second - the original problem here is with the start of line character (^), NOT newline (\n).
I love N++ but not being able to do a simple search-and-replace on the start of line or end of line ($) is a killer for me. I do that sort of operation a lot, and I don't want to (or shouldn't have to) memorize cryptic regex expressions as a workaround for two of the most fundamental (and valid) regex expressions ^ and $.
As a result, I've paid for and use EditPad Pro as my default text editor.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This still doesn't appear to work? Does anyone know if this will eventually be corrected? I realize there are work-arounds, but I flip back and forth between vi and notepad++ all day and it's frustrating having to use a workaround in notepad++ to do this basic thing.
Basically the vi equivalnet of :%s/^/Put this at the beginning:/g
Thanks
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am trying to use regular expression in Search and Replace to put a hyphen at the beginning of each line.
Search: ^
Replace -
This does not work. The error is "The regular expression to search is formed badly".
How do I do this in Notepad Plus? This regular expression works in other programs.
Thanks
Paul
That sounds like a bug. There are several ways to do this kind of thing. Have a read of http://notepad-plus.sourceforge.net/uk/newlineFindReplace-HOWTO.php and hopefully you'll find a method that works.
Hi,
it seems the bug is still there. I have the same problem. Shall we open a new bug report?
It's a well known bug inherited from Scintilla, so it can't easily be fixed. The FAQ I mentioned in that original thread, now at http://notepad-plus.wiki.sourceforge.net/FindReplaceNewlineHowTo , explains all the workarounds I know of. I would forget trying to do it with regex.
Wait a second - the original problem here is with the start of line character (^), NOT newline (\n).
I love N++ but not being able to do a simple search-and-replace on the start of line or end of line ($) is a killer for me. I do that sort of operation a lot, and I don't want to (or shouldn't have to) memorize cryptic regex expressions as a workaround for two of the most fundamental (and valid) regex expressions ^ and $.
As a result, I've paid for and use EditPad Pro as my default text editor.
This still doesn't appear to work? Does anyone know if this will eventually be corrected? I realize there are work-arounds, but I flip back and forth between vi and notepad++ all day and it's frustrating having to use a workaround in notepad++ to do this basic thing.
Basically the vi equivalnet of :%s/^/Put this at the beginning:/g
Thanks
There may be a work around: you can try to use
search ^(.)
replace -\1
But - will not be added to empty lines
try maybe:
search ^(.|\n)
replace -\1
but this won't work if the \n is not supported... or you can try:
search ^(.|$)
replace -\1
but you'll have to try it... (haven't done it myself)
What about search ^(.*)
Replace -\1