HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulehxt-regex-xmlschema-9.2.0.7Haskell2010

Text.Regex.XMLSchema.Generic.Regex

W3C XML Schema Regular Expression Matcher

Grammar can be found under http://www.w3.org/TR/xmlschema11-2/#regexs

  • 1 type
  • 37 values
datadata GenRegex s
#
Instances3Eq, Ord, Show
  • Eq s => Eq (GenRegex s)Defined in hxt-regex-xmlschema-9.2.0.7 · Text.Regex.XMLSchema.Generic.Regex
  • Ord s => Ord (GenRegex s)Defined in hxt-regex-xmlschema-9.2.0.7 · Text.Regex.XMLSchema.Generic.Regex
  • StringLike s => Show (GenRegex s)Defined in hxt-regex-xmlschema-9.2.0.7 · Text.Regex.XMLSchema.Generic.Regex
valuemkZero :: s -> GenRegex s
#

construct the r.e. for the empty set. An (error-) message may be attached

valuemkUnit :: GenRegex s
#

construct the r.e. for the set containing the empty word

valuemkDot :: GenRegex s
#

construct an r.e. for the set of all Unicode chars

valuemkElse :: StringLike s => GenRegex s -> GenRegex s -> GenRegex s
#

construct the r.e. for r1{|}r2 (r1 orElse r2).

This represents the same r.e. as r1|r2, but when collecting the results of subexpressions in (...) and r1 succeeds, the subexpressions of r2 are discarded, so r1 matches are prioritized

example

splitSubex "({1}x)|({2}.)"   "x" = ([("1","x"),("2","x")], "")

splitSubex "({1}x){|}({2}.)" "x" = ([("1","x")], "")
valuemkDiff :: StringLike s => GenRegex s -> GenRegex s -> GenRegex s
#

Construct difference r.e.: r1 {\} r2

example

match "[a-z]+{\\}bush" "obama"     = True
match "[a-z]+{\\}bush" "clinton"   = True
match "[a-z]+{\\}bush" "bush"      = False     -- not important any more
valuemkIsect :: StringLike s => GenRegex s -> GenRegex s -> GenRegex s
#

Construct r.e. for intersection: r1 {&} r2

example

match ".*a.*{&}.*b.*" "-a-b-"  = True
match ".*a.*{&}.*b.*" "-b-a-"  = True
match ".*a.*{&}.*b.*" "-a-a-"  = False
match ".*a.*{&}.*b.*" "---b-"  = False
valuemkExor :: StringLike s => GenRegex s -> GenRegex s -> GenRegex s
#

Construct r.e. for exclusive or: r1 {^} r2

example

match "[a-c]+{^}[c-d]+" "abc"  = True
match "[a-c]+{^}[c-d]+" "acdc" = False
match "[a-c]+{^}[c-d]+" "ccc"  = False
match "[a-c]+{^}[c-d]+" "cdc"  = True
valuefirstChars :: StringLike s => GenRegex s -> CharSet
#

FIRST for regular expressions

this is only an approximation, the real set of char may be smaller, when the expression contains intersection, set difference or exor operators

valuesplitWithRegex
  1. :: StringLike s
  2. => GenRegex s
  3. -> s
  4. -> Maybe (SubexResults s, s)
#

This function wraps the whole regex in a subexpression before starting the parse. This is done for getting access to the whole parsed string. Therfore we need one special label, this label is the Nothing value, all explicit labels are Just labels.

valuesplitWithRegexCS'
  1. :: StringLike s
  2. => GenRegex s
  3. -> CharSet
  4. -> s
  5. -> Maybe (GenRegex s, s)
#

speedup version for splitWithRegex'

This function checks whether the input starts with a char from FIRST re. If this is not the case, the split fails. The FIRST set can be computed once for a whole tokenizer and reused by every call of split