繁体   English   中英

Notepad ++正则表达式将书签行

[英]Notepad++ Regex to bookmark lines

我有这样的行结构列表

c:\names1\ex1
c:\names2\ex2
c:\names3\ex14
http://example1
http://example3
c:\names4\ex15
http://example4
c:\names4\ex17
c:\names4\ex18

我想使用正则表达式来标记所有由c:\\开头的行,而不是http,在这种情况下,应标记前两行和后两行。 因为其他“行也以c:开头”,其后是http:\\

您可以使用以下模式:

^c:.*+(?!\r?\nhttp:)

图案细节:

^                # anchor for the start of the line
c:      
.*+              # zero or more characters until the end of line (possessive)
(?!\r?\nhttp:)   # not followed by a newline and http:

有一个简单的方法可以执行此操作。

  1. 转到搜索 > 查找 ...>选择标记选项卡。 确保在“搜索模式”框下选中“正则表达式”,并确保选中“ 书签行”框。

  2. 您要搜索以下内容,但仍在“ 标记”选项卡下。

     Find what: ^c:\\S++(?!\\r?\\nhttp) 
  3. 最后,单击“ 全部标记”将这些行添加为书签。

在此处输入图片说明

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM