Following code,
@NoDeselect
Rename REGEXP PATTERN="(.)(^| )(The)($| |.)(.)#" TO="\1\2the\4\5"
matches only one "The". How can this be extended to two or any number of matches?
Following code,
@NoDeselect
Rename REGEXP PATTERN="(.)(^| )(The)($| |.)(.)#" TO="\1\2the\4\5"
matches only one "The". How can this be extended to two or any number of matches?
Turn on the Case Sensitive checkbox in the rename dialog (or add the MATCHCASE argument if doing it in a button like your example) and it will work.
This is needed because after applying the regexp for the first time, the before & after strings are identical (if ignoring case) and so Opus will stop instead of applying the regexp again. Making it not ignore case means the strings are considered different and the regexp will be applied repeatedly.
When doing a repeated regexp rename (one with a # at the end of the regexp pattern), Opus will stop when either the regexp no longer matches the string or when the regexp generates a string that it already has. (Since if it's a string that's already been generated, we must be in an infinite loop. Indeed, the original example would create an infinite loop without this check as "the" would keep matching "The" if the search isn't case-sensitive.)
Yeah, now it works, after having added the MATCHCASE. Before i tried to simply use the Regex twice (w. @nodeselect), but that
didn´t work. If only Regex wouldn´t be that complicated.. Thanks!