RegexPatternRecognizer

A TokenRecognizer for Patterns.

Patterns work as for usual regular expressions in Java with the following additional rules:

  • Look-behind and look-ahead can go beyond the bounds of the string that needs to be recognized. Specifically, the pattern's look-behind will correctly go "through" the previously already recognized tokens.

  • The bounds symbols ^ and $ match the start and end of the original string.

Constructors

Link copied to clipboard
constructor(pattern: Pattern)

Functions

Link copied to clipboard
open override fun recognize(s: String, startAt: Int): Pair<String, Int>?

Check whether the string s starting from index startAt matches the pattern this recognizer uses.