Back to LanguageTool Homepage - Privacy - Imprint

Antipatterns for <regexp> rule

Hi, there’s now RegexAntiPatternFilter which help simulate antipattterns for rules which use <regexp>. Example:

<regexp mark="1">(fo.) (bar)</regexp>
<filter class="org.languagetool.rules.patterns.RegexAntiPatternFilter" args="antipatterns:fou"/>

This would match regexp (fo.) (bar), but not fou bar. It’s somewhat limited, as the regex cannot contain spaces. There can be more than one regex like this: args="antipatterns:regex1|regex2|regex3" - i.e. the pipe (|) is used to delimit several regex. For the antipatttern to match, it’s enough if it partially overlaps the match of the <regexp>.