Code: Select all
((?:\m\w+\M)) \1
Code: Select all
((?:\m\w+\M)) \1
Code: Select all
(\<[\w]+\>) \1
Groucho wrote:There's many a way to it. Try this:I hope this is enough. (But I'm sure now Kino will come out with a score of objections and a biblical macro. )Code: Select all
(\<[\w]+\>) \1
Greetings, Henry.
You should have 'Whole Word' checked in the Find window.js wrote: The drawback is that this matches also if the second word is only _beginning_ with the first one, like in “be better”, or “can candy”. How to avoid these?
Code: Select all
Find and Replace '\<(\w+) \1\>', '\1', 'Ea'
Code: Select all
Find and Replace '\\<(\\w+) \\1\>', '\\1', 'Ea'
That's not a problem, because the backslashes are first interpreted in the context of the string literal, and then reinterpreted as a PowerFind/regex. For string literals a "\\" sequence means a single backslash. Perhaps the superfluous escaping is confusing, but both macro commands behave the same.Groucho wrote:By the way (for Martin), I tried the macroize expression command and found it escapes already escaped elements.
Here's a command that does that:js wrote: My idea was to have the macro show the next case of two repeating words, and have one of them already selected so that you can easily delete it
Code: Select all
Find '\b(\w+)\s(?=\1\b)', 'E'
Thanks for the tip, Martin.martin wrote:That's not a problem, because the backslashes are…