[英]Match everything between but exclude words - notepad++
Input: 输入:
start
some
T1
random
T2
text
T3
end
should result in: 应该导致:
start
T1
T2
T3
end
I tried using 我试过用
>(?<=start)[\S\s]*?(?=end)
to match everything between start and end 匹配开始和结束之间的所有内容
and exclude T1 T2 T3 with: 并排除T1 T2 T3:
^(?!T\\d)
Is it possible to combine them into a single regex that can be pasted into notepad++ for people not familiar with writing code to do it in several passes? 是否有可能将它们组合成一个可以粘贴到记事本++中的正则表达式,以便那些不熟悉编写代码的人在几次传递中执行它?
You could use this regular expression: 你可以使用这个正则表达式:
Find: ^(?!T\\d|start).*\\R(?=(^(?!start$).*\\R)*end$)
查找:
^(?!T\\d|start).*\\R(?=(^(?!start$).*\\R)*end$)
Replace: (empty) 替换:(空)
.
matches newlines: No 匹配换行:否
Click "Replace All" 点击“全部替换”
These assumptions are made: 这些假设是:
start
and end
delimiters should each be the only text on their lines (so not ---start
or start ///
), start
和end
分隔符应该是它们行上唯一的文本(所以不是---start
或start ///
), start
and then end
) start
然后end
) start
cannot come another start
before you have an end
. start
不能到另一个start
你有一个前end
。 The look-ahead makes this a rather inefficient regular expression, as with each match it needs to check again the text that follows until the next end
. 前瞻使得这是一个相当低效的正则表达式,因为每次匹配需要再次检查后续文本直到下一个
end
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.