Back to LanguageTool Homepage - Privacy - Imprint

Regexp_match=".*" regexp_replace not working as expected

Hello, with this rule, I would expect the tool to find “tiger”, “leopard” or “puma” and replace it with “lion”, but it replaces them with “lionlion”. Why is it doing that, and how can I fix it?

<rule>
<pattern>
<token regexp="yes">tiger|leopard|puma</token>
</pattern>
<suggestion><match no="1" regexp_match=".*" regexp_replace="lion"/></suggestion>
</rule>

To replace with a specific word, you can just use <suggestion>lion</suggestion>.

There’s also an issue for it at https://github.com/languagetool-org/languagetool/issues/1249.