[英]Using Regex in Notepad++, how do I select only the period inside some specific lines but not inside others
Using Regex in Notepad++, how do I select only the period inside these lines: 在Notepad ++中使用Regex,如何仅选择以下行中的句点:
<div class="english">One. Two. Three. Four. Five.</div>
but leaving alone the period inside these ones: 但不把这些时期放在其中:
<div class="spanish">Uno. Dos. Tres. Cuatro. Cinco.</div>
Thanks 谢谢
If you want to select only the dots between <div class="english">
and </div>
you can use: 如果只想选择
<div class="english">
和</div>
之间的点,则可以使用:
(?:<div class="english">|(?!^)\G)(?:[^.<]|<(?!/div>))*\K\.
Explanation and demo : 说明和演示 :
(?: # non-capturing group
<div class="english"> # our delimiter
| # or
(?!^)\G # the end of the last match
)
(?:
[^.<] # any character except '.' or '<' (even newline)...
| # or ...
<(?!/div>) # '<' not followed by a '/div>'
)*
\K # leave what we found so far out of the match
\. # match the dot
See reference for the use of \\K
and \\G
. 有关
\\K
和\\G
的用法,请参见参考。
<div class="(?!english)[^"]*">.*?<\/div>\K|\.(?=.*?<\/div>)
You can do this using \\K
.See demo. 您可以使用
\\K
执行此操作\\K
参见演示。
https://regex101.com/r/cT0hV4/18 https://regex101.com/r/cT0hV4/18
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.