LanguageTool: words followed by a word different from

advertisements

How can I match a series of words followed by a word different from x?

For instance, how can I match at the cost of followed by a word different from some?

I have tried the following, but to no avail:

<rule id="AT_THE_COST_OF_!SOME" name="at the cost of !some">
<pattern>
<token>at</token>
<token>the</token>
<token>cost</token>
<token>of</token>
<token regexp="yes">/^((?!some).)*$</token>
</pattern>
<message>Did you mean <suggestion>at the cost of some \5</suggestion>?</message>
<example correction='at the cost of some efforts'>Yes, it comes
<marker>at the cost of efforts</marker>.</example>
</rule>


LanguageTool works on tokens. Using regexp is a special case and if using regexp, they work on single tokens (when using pattern). This will solve your problem:

<pattern>
    <token>at</token>
    <token>the</token>
    <token>cost</token>
    <token>of</token>
    <token><exception>some</exception></token>
</pattern>

To use regular expressions anyway, use <regexp> as documented at http://wiki.languagetool.org/development-overview#toc8.