
Notepad++ can do that comfortably, you don't even need regexes How to express the newline in regex, please? Note that if there should be a match on the last line of the string, without a matching trailing line return, the match fails.And you want to find the sequence abc (and select the whole 3 lines) with Notepad++. To not select the trailing line return, as appropriate for replacing with a non-empty string, simply remove the final line return from the matching statement. Wasn't clear if the OP intent is to select the trailing line return (after the 'c') as well, as would be necessary to remove the lines. Or in the Find what Textbox for Unix: a\nb\nc\n.And in the Find what Textbox for Windows: a\r\nb\r\nc\r\n.Select Search Mode > Extended (\n, \r, \t, \0, \x.).
Or if you are looking at the (Windows or Unix) file to see its line breaks as \r\n or \n then you may find it easier to use Extended Mode:
Select Search Mode > Regular expression (w/o. Solution 5įor Notepad 6 and beyond, do this as a regular expression: Next, switch to Extended mode again and replace all ,newline, to \r\n. Then switch to Regexp mode, do some replacements (now newline is ,newline,). ,newline, (watch out for special regexp chars like $, &, and *). Simply, in Extended mode replace all \r\n to a string that didn't exist in the rest of the document eg. Assumption is that each line in your file ends with ascii 10 and 13. This will work \x0D is newline and \x0A is carriage return. It does work, but not when using regular expressions search. Update: Robb and StartClass0830 were right about extended search. You can use extended search for newline searching, but I don't think that will help you search for 3 lines. Notepad++ is based on the Scintilla editor component, which doesn't handle newlines in regex. Unfortunately, you can't do that in Notepad++ when using regex search. Note \r\n is Windows encoding of line-breaks. So you can just use a\r\nb\r\ncĮven with regular expressions to accomplish what you want. With the new Notepad++ v6, you can indeed search for newlines with regexes. Will find the pattern over three lines Solution 2
In the find dialogue box look in the bottom left and switch your search mode to Extended which allows \n etc.Īs odds on you're working on a file in windows format you'll be looking for \r\n (carriage return, newline) a\r\nb\r\nc