Back to LanguageTool Homepage - Privacy - Imprint

Regex problem for straight quotes preferred in style guide


(KHB) #1

We use straight quotes where I work. I’m trying to get this rule to work:

<rule id="CHC_STRAIGHT_QUOTES" name="CHC_STRAIGHT_QUOTES">
 <pattern>
  <token regexp='yes'>(‘|’|“|”|‹‹|››)</token>
 </pattern>
 <message>CHC SPM chapter 3, use straight quotes</message>
 <short>Use straight quotes</short>
 <example correction=''>Use straight<marker>’</marker> quotes. Not curly’ quotes.</example>
 <example>These are the 'quotes' to use.</example>
</rule>

The rule works when I run it here: https://community.languagetool.org/ruleEditor/expert
But when I try to launch languagetool.jar it throws an error.
I’ve even tried defining my regex quotes using unicode: \u2018|\u2019
Any ideas welcome.


(Daniel Naber) #2

What exactly does the error message say?


(Ruud Baars) #3

Might not be the problem, bu you are using single quote around ‘yes’, and double in for name value e.g.


(Ruud Baars) #4

Correction seems to be empty, and also you seem to suggest a non-straight quot. But that might be the forum trying to be smart as well.


(KHB) #5

Thank you all for your help. Looking with fresh eyes this morning I noticed I had created an extra close rulegroup ‘’. Now it works perfectly.
@dnaber, the message was basically saying: ‘Caused by: java.lang.RuntimeException: Could not activate rules’.
Again, thank you all :slight_smile: