How can I find/replace all CRLF characters in notepad++? Looking for something equivalent to the ^p special character in Word.
Assuming it has a "regular expressions" search, look for \r\n. I prefer \r?\n, because some files don't use carriage returns.
EDIT: Thanks for the feedback, whoever voted this down. I have learned that... well, nothing, because you provided no feedback. Why is this wrong?
[\r\n]+ should work too
Actually no, it does not seem to work with regexp...
But if you have notepad++ 5.x, you can use the 'extended' search mode and look for \r\n. That does find all your CRLF.
(I realize this is the same answer than the others, but again, 'extended mode' is only available with Notepad++4.9, 5.x and more)
On the Replace dialog, you want to set the search mode to "Extended". Normal or Regular Expression modes wont work.
Then just find "\r\n" (or just \n for unix files or just \r for mac format files), and set the replace to whatever you want.
I've not had much luck with \r\n regular expressions from the find/replace window.
However, this works in Notepad++ v4.1.2:
Use the "View | Show end of line" menu to enable display of end of line characters. (Carriage return line feeds should show up as a single shaded CRLF 'character'.)
Select one of the CRLF 'characters' (put the cursor just in front of one, hold down the SHIFT key, and then pressing the RIGHT CURSOR key once).
Copy the CRLF character to the clipboard.
Make sure that you don't have the find or find/replace dialog open.
Open the find/replace dialog. The 'Find what' field shows the contents of the clipboard: in this case the CRLF character - which shows up as 2 'box characters' (presumably it's an unprintable character?)
Ensure that the 'Regular expression' option is OFF.
Now you should be able to count, find, or replace as desired.
It appears that this is a FAQ, and the resolution offered is:
Simple search (Ctrl+H) without regexp
You can turn on View/Show End of Line or view/Show All, and select the now visible newline characters. Then when you start the command some characters matching the newline character will be pasted into the search field. Matches will be replaced by the replace string, unlike in regex mode.
Note 1: If you select them with the mouse, start just before them and drag to the start of the next line. Dragging to the end of the line won't work.
Note 2: You can't copy and paste them into the field yourself.
Advanced search (Ctrl+R) without regexp
Ctrl+M will insert something that matches newlines. They will be replaced by the replace string.
Just to build a little on what 'thenonhacker' was mentioning. We use ULtraEdit-32 on the job, and working with EDI files (x.12), we often have to wrap or unwrap data. The 2 most common Search & Replace strings are "^p" & "~". going one way will replace the "~" with a CR/LF for easier reading of each segment. Going the other way puts the file back into the format the EDI translator needs.
For lazy people like myself, I just have those map'd to keys for easy of use.