How to find the tab character?

I would like to make rules that find the tab character in some contexts. Is it possible, and if yes, how?

This rule partly works:

<rule id="TAB_CHARACTER" name="Find a tab character">
    <message>Found a tab</message>
    <example correction="">A tab character: a<marker>&#x9;</marker>b between a and b.</example>
    <example>No tab character.</example>


But, testrules gives this warning:

Running pattern rule tests for English... Exception in thread "main" java.lang.AssertionError: English rule TAB_CHARACTE
"A tab character: ab between a and b."
Errors expected: 1
Errors found   : 0
Message: Found a tab
Analyzed token readings: [/SENT_START*] A[a/DT*,B-NP-singular]  [ /null*] tab[tab/NN,I-NP-singular]  [ /null*] character
[character/NN:UN,E-NP-singular] :[:/:*,O]  [ /null*] ab[ab/null,B-NP-singular|E-NP-singular]  [ /null*] between[between/
IN,B-PP]  [ /null*] a[a/NNP,B-NP-singular]  [ /null*] and[and/CC,I-NP-singular]  [ /null*] b[b/null,E-NP-singular] .[./.
Matches: []

Also, the right-click menu does not work fully.

W3C Schools (W3Schools Tryit Editor) shows 3 ways to represent the tab character in HTML. If I use &Tab;, testrules gives this warning:

Exception in thread "main" Cannot load or parse '/org/languagetool/rules/en/grammar.xml'
        at org.languagetool.XMLValidator.validateWithXmlSchema(
        at org.languagetool.rules.patterns.PatternRuleTest.validatePatternFile(
        at org.languagetool.rules.patterns.PatternRuleTest.runTestForLanguage(
        at org.languagetool.rules.patterns.PatternRuleTest.runGrammarRulesFromXmlTestIgnoringLanguages(PatternRuleTest.j
        at org.languagetool.rules.patterns.PatternRuleTest.main(
Caused by: org.xml.sax.SAXParseException; lineNumber: 118; columnNumber: 26; The entity "Tab" was referenced, but not de
        at Source)

Just press the Tab key on the keyboard and you’ll be fine.

@udomai, update 2020-10-23

I changed the rule to use the Unicode code point: Unicode Character 'CHARACTER TABULATION' (U+0009). Also, I used tokens rather than regexp. Unicode code points work fine in NON_STANDARD_ALPHABETIC_CHARACTERS.

<rule id="TAB_CHARACTER2" name="Find a tab character">
        <token regexp="yes">\b(\u0009|\u043E)\b</token>
    <message>Found a tab v2</message>
    <example correction="">Cyrillic small <marker>letter о is</marker> found.</example>
    <example correction="">Tab character between <marker>two	words</marker>.</example>
    <example>No tab character.</example>

Testrules gives this warning:
Exception in thread “main” org.languagetool.rules.patterns.PatternRuleTest$PatternRuleTestFailure: Test failure for rule TAB_CHARACTER2[1] in file /org/languagetool/rules/en/grammar.xml: Tab character between twowords."
Errors expected: 1
Errors found : 0
Message: Found a tab v2

Note: twowords

LT does not ‘see’ the tab:

@Mike_Unwalla, I think this might actually be worth an issue. Just to make sure this doesn’t cause any build or test problems…

@udomai, there is an issue already: Let the grammar rules find any Unicode character · Issue #1755 · languagetool-org/languagetool · GitHub