Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find end of the line in a regular expression using Notepad++

I am working with Notepad++ and I would like to find the new line (after the hyphen, optional space and some characters in the end line).

I have came up with something like this:

  • -[ ]?.*\n

I have also tried:

  • -[ ]?.*(\n)
  • -[ ]?.*(\r\n)
  • -[ ]?.*[\r\n]
  • -[ ]?.*[\n]

None of these worked. I am working on Windows if it matters.

like image 670
Patryk Avatar asked Feb 29 '12 19:02

Patryk


2 Answers

If you do not actually need to match the line break, you can simply use $ which is the anchor for end of a line.

like image 154
Joey Avatar answered Nov 17 '22 15:11

Joey


\R (capital R) will grab any end of line characters in Notepad++.

I usually do something like this:

-.+\R will grab everything from the hyphen through to the end of line as well as any return characters.

$ for end of line and ^ for start of line are your friends too.

http://docs.notepad-plus-plus.org/index.php/Regular_Expressions

like image 42
WiredUp4Fun Avatar answered Nov 17 '22 16:11

WiredUp4Fun