According to http://sourceforge.net/forum/forum.php?forum_id=818371 , v4.9 and above can do more than before when it comes to finding and replacing newlines:
"9. Enhance Find Replace dialog : Add "Extended" option - search (and replace) for tabs(\t), newline(\n\r), and a characters by it's value (\o, \x, \b, \d, \t, \n, \r and \\)."
Firstly, I'd like to thank whoever is responsible for fixing this shortcoming of Notepad++. The FAQ at http://notepad-plus.wiki.sourceforge.net/FindReplaceNewlineHowTo was written to help the many people struggling with this, and hopefully it's mostly obsolete now.
\r seems to correspond to CR, and \n corresponds to LF, so what you use to represent a newline differs according to the filetype. $ seems to not be supported to represent a universal newline in the replace field of the control+H dialog, which is a pity. Perhaps there's still a place for that FAQ.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Heres the list:
\n: LF
\r: CR
\b: Binary number, MUST be followed by 8 1s or 0s
\o: Octal, MUST be followed by three numbers from 0-7
\d: Decimal, MUST be followed by three numbers from 0-9
\x: Hexadecimal, MUST be followed by two numbers/letters from 0-9 and a-f (afaik not case sensitive)
\0: NUL character, you can also use any of the above 4 but this is just a little shortcut.
\\: Backslash
Of it finds a backslash with something behind it it cannot escape, it will treat it as regular text, so if you make a mistake and type
"bla\fla", it'll search for "bla\fla". This also goes for any numbers you try to escape but are incorrectly formed, thus searching for
"\d27" will search literally for "\d27", but if you type "\d027" it'll search for the "ESC" character (decimal 27).
The reason numbers have to be formed so exact is that it makes more simple code. Usually you'll search for HEX anyway which usually
means two numbers. The other bases are just a by-product.
This also means that if you search for decimal 1, you have to put in enough leading zeros to make it fit.
There is no universal newline because the search would have to be for both CR and LF at the exact same time at the same location,
Scintilla isn't really suited for this. You just have to use regexp for that or convert all newlines to the same type. This search happens
on a per-character basis, not per-line. This adds possibilities but also limitations, as with nearly any choice in life :).
This might indeed be material for some documentation but I haven't found (time/)the will to add it to the wiki :).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
-----
Replacing newline characters with v4.9 and above
Ctrl+H with Extended option selected instead of Regexp. Search for "\r\n", or whatever your OS uses, and replace with what you need. It will replace the newline characters with what you entered. Note that Windows uses CR-LF newlines (\r\n), Mac uses CR (\r) and Unix uses LF (\n). You can use View/Show End of Line to see which characters your file uses - files from other OSs may not behave as you expect because they have a different newline type.
Some examples:
- To add a string to the end of all lines in Windows, in control+H with Extended mode enabled, replace \r\n with string\r\n
- To add a string to the beginning of all lines in windows, in control+H with Extended mode enabled, replace \r\n with \r\nstring
- To reove blank line in windows, in control+H with Extended mode enabled, replace with \r\n
- To remove all newlines, in control+H with Extended mode enabled, replace \r\n with nothing.
-----
also if you want to remove blank lines you can replace (^h) \r\n\r\n with nothing .. it seems replaces are recursives
thanks to all .. see us :)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Is there any reason why the Extended Mode in the Ctrl+H Replace Dialog is case sensitive for the entered characters? For instance, \t will find or replace a tab character, but \T doesn't. I think it should treat both as \t. Please simply downcase the entered sequence before applying it.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
in previous versions you can -glue- separate lines by selecting endlines, then opening replace dialog with selected endlines, shown automatically in source text as 2 squares, then replacing with any char (or no char) in destination text ... example: replace <crlf> with "-":
this
is
an
example
this-is-an-example
NOW YOU CAN'T DO IT BECAUSE THERE IS NO WAY TO PUT LINE BREAKS IN SOURCE DIALOG ... that was so very useful
how can i specify line breaks in source dialog now ?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
According to http://sourceforge.net/forum/forum.php?forum_id=818371 , v4.9 and above can do more than before when it comes to finding and replacing newlines:
"9. Enhance Find Replace dialog : Add "Extended" option - search (and replace) for tabs(\t), newline(\n\r), and a characters by it's value (\o, \x, \b, \d, \t, \n, \r and \\)."
Firstly, I'd like to thank whoever is responsible for fixing this shortcoming of Notepad++. The FAQ at http://notepad-plus.wiki.sourceforge.net/FindReplaceNewlineHowTo was written to help the many people struggling with this, and hopefully it's mostly obsolete now.
Secondly, can someone tell me what all those characters do, e.g. \o \x, etc? They aren't mentioned at http://notepad-plus.sourceforge.net/uk/regExpList.php .
\r seems to correspond to CR, and \n corresponds to LF, so what you use to represent a newline differs according to the filetype. $ seems to not be supported to represent a universal newline in the replace field of the control+H dialog, which is a pity. Perhaps there's still a place for that FAQ.
Heres the list:
\n: LF
\r: CR
\b: Binary number, MUST be followed by 8 1s or 0s
\o: Octal, MUST be followed by three numbers from 0-7
\d: Decimal, MUST be followed by three numbers from 0-9
\x: Hexadecimal, MUST be followed by two numbers/letters from 0-9 and a-f (afaik not case sensitive)
\0: NUL character, you can also use any of the above 4 but this is just a little shortcut.
\\: Backslash
Of it finds a backslash with something behind it it cannot escape, it will treat it as regular text, so if you make a mistake and type
"bla\fla", it'll search for "bla\fla". This also goes for any numbers you try to escape but are incorrectly formed, thus searching for
"\d27" will search literally for "\d27", but if you type "\d027" it'll search for the "ESC" character (decimal 27).
The reason numbers have to be formed so exact is that it makes more simple code. Usually you'll search for HEX anyway which usually
means two numbers. The other bases are just a by-product.
This also means that if you search for decimal 1, you have to put in enough leading zeros to make it fit.
There is no universal newline because the search would have to be for both CR and LF at the exact same time at the same location,
Scintilla isn't really suited for this. You just have to use regexp for that or convert all newlines to the same type. This search happens
on a per-character basis, not per-line. This adds possibilities but also limitations, as with nearly any choice in life :).
This might indeed be material for some documentation but I haven't found (time/)the will to add it to the wiki :).
I GOT IT ! ... in http://notepad-plus.wiki.sourceforge.net/FindReplaceNewlineHowTo at the bottom says...
-----
Replacing newline characters with v4.9 and above
Ctrl+H with Extended option selected instead of Regexp. Search for "\r\n", or whatever your OS uses, and replace with what you need. It will replace the newline characters with what you entered. Note that Windows uses CR-LF newlines (\r\n), Mac uses CR (\r) and Unix uses LF (\n). You can use View/Show End of Line to see which characters your file uses - files from other OSs may not behave as you expect because they have a different newline type.
Some examples:
- To add a string to the end of all lines in Windows, in control+H with Extended mode enabled, replace \r\n with string\r\n
- To add a string to the beginning of all lines in windows, in control+H with Extended mode enabled, replace \r\n with \r\nstring
- To reove blank line in windows, in control+H with Extended mode enabled, replace with \r\n
- To remove all newlines, in control+H with Extended mode enabled, replace \r\n with nothing.
-----
also if you want to remove blank lines you can replace (^h) \r\n\r\n with nothing .. it seems replaces are recursives
thanks to all .. see us :)
Is there any reason why the Extended Mode in the Ctrl+H Replace Dialog is case sensitive for the entered characters? For instance, \t will find or replace a tab character, but \T doesn't. I think it should treat both as \t. Please simply downcase the entered sequence before applying it.
Conventionally \t, \n or \r are lower case, and I think it makes more sense.
Don
in previous versions you can -glue- separate lines by selecting endlines, then opening replace dialog with selected endlines, shown automatically in source text as 2 squares, then replacing with any char (or no char) in destination text ... example: replace <crlf> with "-":
this
is
an
example
this-is-an-example
NOW YOU CAN'T DO IT BECAUSE THERE IS NO WAY TO PUT LINE BREAKS IN SOURCE DIALOG ... that was so very useful
how can i specify line breaks in source dialog now ?