Hello, @vasile-caraus, @peterjones and All,
Here is my attempt, which is able to match and delete all duplicate words, one at a time, in any line <p class="bebe">..........</p>
SEARCH (?-s)(?:<p class="bebe">|\G).*?\h+((&\#\d+;|[\w'-])+)\h\K\h*\1[\h,;.]+(?=.*?</p>)
REPLACE Leave EMPTY
If you prefer to use the free spacing mode and in-line comments, here is the search regex :
(?x) # FREE-SPACING mode
(?-s) # The DOT represents a single STANDARD character
(?:<p[ ]class="bebe">|\G ) # The string <p class="bebe"> or the CURRENT position, in a NON-CAPTURING group
.*? # The SMALLEST range of STANDARD characters, ONLY
\h+ # A NON null range of HORIZONTAL BLANK characters
( (&\#\d+;|[\w'-])+ ) # The string &#, followed with digit(s) + a SEMICOLON or a WORD character or a SINGLE QUOTE or a DASH
# possibly REPEATED, so a WORD stored as GROUP 1
\h # One HORIZONTAL BLANK character
\K # Everything ALREADY matched is DISCARDED
\h* # A range, possibly NULL of HORIZONTAL BLANK character(s)
\1 # The DUPLICATE word
[\h,;.]+ # Any NON null range of HORIZONTAL BLANK character or a COMMA or a SEMICOLON or a DOT, possibly REPEATED
(?=.*?</p>) # ONLY IF followed with the SMALLEST range of STANDARD characters + the STRING </p>) in the CURRENT line
Just test these two identical versions, against the sample text, below :
<p class="bebe">My husband and I are transforming our our long-neglected, creaky old Victorian house into our favorite place on earth.</p>
<p class="bebe">My husband and I are transforming our ourş long-neglected, creaky old Victorian house into our favorite place on earth.</p>
<p class="bebe">My husband and I are transforming ourş our long-neglected, creaky old Victorian house into our favorite place on earth.</p>
<p class="bebe">My husband and I are transforming ourş ourş long-neglected, creaky old Victorian house into our favorite place on earth.</p>
<p class="bebe">My husband and I are transforming ourş ourő long-neglected, creaky old Victorian house into our favorite place on earth.</p>
---
<p class="bebe">My husband and I are transforming our şour long-neglected, creaky old Victorian house into our favorite place on earth.</p>
<p class="bebe">My husband and I are transforming şour our long-neglected, creaky old Victorian house into our favorite place on earth.</p>
<p class="bebe">My husband and I are transforming şour şour long-neglected, creaky old Victorian house into our favorite place on earth.</p>
<p class="bebe">My husband and I are transforming şour őour long-neglected, creaky old Victorian house into our favorite place on earth.</p>
<p class="bebe">My husband and I are transforming şour ourő long-neglected, creaky old Victorian house into our favorite place on earth.</p>
---
<p class="bebe">My husband and I are transforming our ourşour long-neglected, creaky old Victorian house into our favorite place on earth.</p>
<p class="bebe">My husband and I are transforming ourşour our long-neglected, creaky old Victorian house into our favorite place on earth.</p>
<p class="bebe">My husband and I are transforming ourş ourşour long-neglected, creaky old Victorian house into our favorite place on earth.</p>
<p class="bebe">My husband and I are transforming ourşour ourş long-neglected, creaky old Victorian house into our favorite place on earth.</p>
<p class="bebe">My husband and I are transforming şour ourşour long-neglected, creaky old Victorian house into our favorite place on earth.</p>
<p class="bebe">My husband and I are transforming ourşour şour long-neglected, creaky old Victorian house into our favorite place on earth.</p>
---
<p class="bebe">My husband and I are transforming ourşour ourşour long-neglected, creaky old Victorian house into our favorite place on earth.</p>
<p class="bebe">My husband and I are transforming ourşour ourőour long-neglected, creaky old Victorian house into our favorite place on earth.</p>
---
<p class="bebe">My husband and I are transforming our long-neglected long-neglected, creaky old Victorian house into our favorite place on earth.</p>
<p class="bebe">My husband and I are transforming our long-neglected long-neglected; creaky old Victorian house into our favorite place on earth.</p>
<p class="bebe">My husband and I are transforming our long-neglected long-neglected. creaky old Victorian house into our favorite place on earth.</p>
<p class="bebe">My husband and I are transforming our fisherman's fisherman's hut.</p>
---
<p class="bebe">My husband and I are transforming our our long-neglected, creaky old old Victorian house into our favorite place on earth.</p>
<p class="bebe">My husband and I are transforming our our long-neglected, creaky old Victorian house into our favorite place on earth.</p>
To be logic, only the non empty lines 1, 4, 8, 17, and from 19 to 24 match !
So, after a click on the Replace All button, exclusively, it should give the following text :
<p class="bebe">My husband and I are transforming our long-neglected, creaky old Victorian house into our favorite place on earth.</p>
<p class="bebe">My husband and I are transforming our ourş long-neglected, creaky old Victorian house into our favorite place on earth.</p>
<p class="bebe">My husband and I are transforming ourş our long-neglected, creaky old Victorian house into our favorite place on earth.</p>
<p class="bebe">My husband and I are transforming ourş long-neglected, creaky old Victorian house into our favorite place on earth.</p>
<p class="bebe">My husband and I are transforming ourş ourő long-neglected, creaky old Victorian house into our favorite place on earth.</p>
---
<p class="bebe">My husband and I are transforming our şour long-neglected, creaky old Victorian house into our favorite place on earth.</p>
<p class="bebe">My husband and I are transforming şour our long-neglected, creaky old Victorian house into our favorite place on earth.</p>
<p class="bebe">My husband and I are transforming şour long-neglected, creaky old Victorian house into our favorite place on earth.</p>
<p class="bebe">My husband and I are transforming şour őour long-neglected, creaky old Victorian house into our favorite place on earth.</p>
<p class="bebe">My husband and I are transforming şour ourő long-neglected, creaky old Victorian house into our favorite place on earth.</p>
---
<p class="bebe">My husband and I are transforming our ourşour long-neglected, creaky old Victorian house into our favorite place on earth.</p>
<p class="bebe">My husband and I are transforming ourşour our long-neglected, creaky old Victorian house into our favorite place on earth.</p>
<p class="bebe">My husband and I are transforming ourş ourşour long-neglected, creaky old Victorian house into our favorite place on earth.</p>
<p class="bebe">My husband and I are transforming ourşour ourş long-neglected, creaky old Victorian house into our favorite place on earth.</p>
<p class="bebe">My husband and I are transforming şour ourşour long-neglected, creaky old Victorian house into our favorite place on earth.</p>
<p class="bebe">My husband and I are transforming ourşour şour long-neglected, creaky old Victorian house into our favorite place on earth.</p>
---
<p class="bebe">My husband and I are transforming ourşour long-neglected, creaky old Victorian house into our favorite place on earth.</p>
<p class="bebe">My husband and I are transforming ourşour ourőour long-neglected, creaky old Victorian house into our favorite place on earth.</p>
---
<p class="bebe">My husband and I are transforming our long-neglected creaky old Victorian house into our favorite place on earth.</p>
<p class="bebe">My husband and I are transforming our long-neglected creaky old Victorian house into our favorite place on earth.</p>
<p class="bebe">My husband and I are transforming our long-neglected creaky old Victorian house into our favorite place on earth.</p>
<p class="bebe">My husband and I are transforming our fisherman's hut.</p>
---
<p class="bebe">My husband and I are transforming our long-neglected, creaky old Victorian house into our favorite place on earth.</p>
<p class="bebe">My husband and I are transforming our long-neglected, creaky old Victorian house into our favorite place on earth.</p>
As you noticed, in line 23, the two duplicate words our and old are, both, found and deleted ;-))
Cheers,
guy038