A symbolic regex algebra with exact language containment ("is this pattern a subset of that one?") in addition to the usual construction combinators — not just string matching. Pure Scala, no java.util.regex (or any other JVM-only API) anywhere in the implementation, so it compiles and runs identically on the JVM, Scala.js, and Scala Native.
Construct via smart factories on the companion (Regex.lit, Regex.literal, Regex.range, Regex.apply, Regex.alt, Regex.inter, Regex.all) and member combinators (a concat b, a | b, a & b, !a, r.star, r.repeat(n, m)). Raw case class constructors are inaccessible — only pattern matching via the generated unapply methods is allowed.
Supports literals, escapes (\d \D \s \S \w \W \t \n \r \f \a \e \v \cX \0[n[n]] \xhh \x{h...h} \uhhhh \Q...\E \R and meta-escapes), character classes (including ranges and negation), ., alternation |, non-capturing-style groups (...), quantifiers * + ? {n} {n,} {n,m} (bounds capped at Regex.maxRepeatBound).
Unsupported (parser returns RegexParseError.UnsupportedFeature): anchors ^ $ \b \B \A \Z \z \G, lookaround (?= (?! (? \g{...}, Unicode properties \p{...}, grapheme clusters \X.
For subset/emptiness/nullability queries and Brzozowski derivatives, see Subset.
Attributes
- Companion
- object
- Graph
-
- Supertypes