Back to LanguageTool Homepage - Privacy - Imprint

Case replacement for part of word

In Dutch, DVD and CD should be written as dvd and cd, also in compounds. Is there a way to replace CD-woord and DVD-woord in one replacement regexp to cd-woord and dvd-woord?

The only way I can think of is with two rules in a group:
<message>Did you mean <suggestion><match no="1" regexp_match="^CD" regexp_replace="cd"/></suggestion>?
and the same for DVD\-.+.

I hoped there would be a smart trick. But this will work.

BTW-.* BTW hoeft niet met hoofdletters: Ik doe de BTW-boeking.

This gives an error; I think it is the built-in case correction which is in the way…

Exception in thread “main” java.lang.AssertionError: Dutch: Incorrect suggestions: [btw-boeking] != [Btw-boeking] for rule TST_HOOFDLETTERS_OVERBODIG[2] on input: Ik doe de BTW-boeking. expected:<[btw-boeking]> but was:<[Btw-boeking]>

Sorry, I forgot that part: add case_conversion="alllower" inside the match tag. This works for German at least.

Allower is all that is needed. It is not exactly what I need, but good enough in most cases.

1 Like