[英]How to extract all the strings between 2 patterns using regex Notepad++?
[英]How to remove all the lines between two patterns in notepad++?
我正在嘗試替換以下文本
"{print next
error
incorrect
err
}end"
至
"{print }end"
任何我正在使用(\{print)(.*?)(\}end)
但不工作。 從print和end中刪除所有內容也可以
你可以使用
\{print\h+\K[^{}]*\R(?=}end)
解釋
\{
匹配{
print\h+
匹配打印和 1+ 個水平空白字符\K
忘記 wat 到目前為止是匹配的[^{}]*\R
匹配除{
或}
和換行符以外的任何字符 0+ 次(?=}end)
正向前瞻,斷言右邊是}end
在替換中使用空字符串。
我越來越熟悉正則表達式的使用,所以在這里我分享我的方法....
查找內容: next[\s\S]+?(?=})
替換為: nothing
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.