记事本++换行符在正则表达式 [英] Notepad++ newline in regex

查看:334
本文介绍了记事本++换行符在正则表达式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设你有这个档案:

  x 
a
b
c
x
x
a
b
c
x
x

并且您想用Notepad ++找到 sequence abc (并选择全部3行)。如何在regex中表示换行符?

解决方案

Notepad ++可以做到这一点舒服,你甚至不需要正则表达式

p>

在查找对话框中查找左下角,并将搜索模式切换为扩展,允许\ n等。

<您可能正在寻找\r\\\
(回车,换行)

  a \r\\\
b\r\\\
c

找到三行以上的图案


Suppose you have this file:

x
a
b
c
x
x
a
b
c
x
x

and you want to find the sequence abc (and select the whole 3 lines) with Notepad++ . How to express the newline in regex, please?

解决方案

Notepad++ can do that comfortably, you don't even need regexes

In the find dialogue box look in the bottom left and switch your search mode to Extended which allows \n etc.

As 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

Will find the pattern over three lines

这篇关于记事本++换行符在正则表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆