Regex 记事本++;正则表达式用于为行添加书签
我有这样的行列表Regex 记事本++;正则表达式用于为行添加书签,regex,notepad++,Regex,Notepad++,我有这样的行列表 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:too开头”后跟http:\作为行的开头,所以您可以使用以下模式: ^c
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:too开头”后跟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:
您可以使用以下模式:
^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:
有一种简单的方法可以实现这一点
Find what: ^c:\S++(?!\r?\nhttp)
有一种简单的方法可以实现这一点
Find what: ^c:\S++(?!\r?\nhttp)
谢谢你的解释谢谢你的解释