[英]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:
有一個簡單的方法可以執行此操作。
轉到搜索 > 查找 ...>選擇標記選項卡。 確保在“搜索模式”框下選中“正則表達式”,並確保選中“ 書簽行”框。
您要搜索以下內容,但仍在“ 標記”選項卡下。
Find what: ^c:\\S++(?!\\r?\\nhttp)
最后,單擊“ 全部標記”將這些行添加為書簽。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.