interface RegexRule
implements Rule
import { type RegexRule } from "https://deno.land/x/leac@v0.6.0/leac.ts";
Regex rule - looks for a regular expression match.
Properties
Regular expression to match.
-
Can't have the global flag.
-
All regular expressions are used as sticky, you don't have to specify the sticky flag.
-
Empty matches are considered as non-matches - no token will be emitted in that case.
Replacement string can include patterns, the same as String.prototype.replace().
This will only affect the text property of an output token, not it's offset or length.
Note: the regex has to be able to match the matched substring when taken out of context in order for replace to work - boundary/neighborhood conditions may prevent this.