繁体   English   中英

在Notepad ++中使用Regex,如何只选择某些特定行内的句点而不选择其他行内的句点

[英]Using Regex in Notepad++, how do I select only the period inside some specific lines but not inside others

在Notepad ++中使用Regex,如何仅选择以下行中的句点:

<div class="english">One. Two. Three. Four. Five.</div>

但不把这些时期放在其中:

<div class="spanish">Uno. Dos. Tres. Cuatro. Cinco.</div>

谢谢

如果只想选择<div class="english"></div>之间的点,则可以使用:

(?:<div class="english">|(?!^)\G)(?:[^.<]|<(?!/div>))*\K\.

说明和演示

(?:                     # 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

有关\\K\\G的用法,请参见参考。

<div class="(?!english)[^"]*">.*?<\/div>\K|\.(?=.*?<\/div>)

您可以使用\\K执行此操作\\K参见演示。

https://regex101.com/r/cT0hV4/18

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM