Regex

halotukozak.regex.Regex
See theRegex companion object
enum Regex

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
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Type members

Enum entries

final case class Alt

Alternation. Stored as a Set for ACI normalization. Always size ≥ 2.

Alternation. Stored as a Set for ACI normalization. Always size ≥ 2.

Attributes

final case class Chars

Matches any single code point in set.

Matches any single code point in set.

Attributes

final case class Compl

Complement ¬r.

Complement ¬r.

Attributes

final case class Concat

Concatenation a · b.

Concatenation a · b.

Attributes

case Empty extends Regex

Matches no string.

Matches no string.

Attributes

case Eps extends Regex

Matches the empty string ε.

Matches the empty string ε.

Attributes

final case class Inter

Intersection. Stored as a Set for ACI normalization. Always size ≥ 2.

Intersection. Stored as a Set for ACI normalization. Always size ≥ 2.

Attributes

final case class Star

Kleene star r*.

Kleene star r*.

Attributes