问题
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.
回答1:
Do you actually need to match the line break? If not, you can simply use $
which is the anchor for end of a line.
回答2:
\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
来源:https://stackoverflow.com/questions/9505123/find-end-of-the-line-in-regular-expression-using-notepad