Using Regex in Notepad++, how do I select only the period inside these lines:
<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">|(?!^)\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
<div class="(?!english)[^"]*">.*?<\/div>\K|\.(?=.*?<\/div>)
You can do this using \\K
.See demo.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.