# LDC-E2117 — A text pattern outside the supported grammar ## What it means Text matching uses a bounded pattern grammar: only the pattern shapes the language defines are accepted. A pattern that breaks that grammar — an unclosed class, a stray operator — cannot be compiled, so the compiler rejects it at the literal and says which part went wrong. Closing the class, escaping the stray character, or otherwise bringing the pattern back inside the supported shapes fixes it. The message quotes the offending pattern, so the repair starts there. ## Example ```law language "law.core" version "0.2"; package demo.diagnostics version "0.1.0"; namespace "urn:law:demo:diagnostics"; entity Akt; relation value_of(a: Akt, v: Text) kind empirical; relation ok(a: Akt) kind institutional; rule R(a: Akt, v: Text) strict { when value_of(a, v) and text_matches(v, "[0-9"); then ok(a); } ``` ## Fix ```law language "law.core" version "0.2"; package demo.diagnostics version "0.1.0"; namespace "urn:law:demo:diagnostics"; entity Akt; relation value_of(a: Akt, v: Text) kind empirical; relation ok(a: Akt) kind institutional; rule R(a: Akt, v: Text) strict { when value_of(a, v) and text_matches(v, "[0-9]+"); then ok(a); } ``` ## Engine message The engine reports this in its own wording: ```text example.law:9:43: error LDC-E2117: text_matches: pattern «[0-9» violates the §257.1 grammar: unclosed class `[` ``` ## Related - [Expressions and quantities](/constructs/expressions-quantities/) — how text matching is written.