Find end of the line in regular expression using notepad++

不打扰是莪最后的温柔 提交于 2020-04-08 05:42:06

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!