HORIZON HASKELLDocslts/ghc-9.14.x45dd5372026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 9.14.1 · lts/ghc-9.14.x · 45dd537 · 2026-10-11

Moduleskylighting-core-0.15Haskell2010

Skylighting.Regex

  • 2 types
  • 9 values
datadata Regex
#
Instances3Show, Semigroup, Monoid
  • Show RegexDefined in skylighting-core-0.15 · Regex.KDE.Regex
  • Semigroup RegexDefined in skylighting-core-0.15 · Regex.KDE.Regex
  • Monoid RegexDefined in skylighting-core-0.15 · Regex.KDE.Regex
datadata RE
#

A representation of a regular expression.

Instances8Eq, Data, Ord, Read, Show, Binary, …
  • Eq REDefined in skylighting-core-0.15 · Skylighting.Regex
  • Data REDefined in skylighting-core-0.15 · Skylighting.Regex
  • Ord REDefined in skylighting-core-0.15 · Skylighting.Regex
  • Read REDefined in skylighting-core-0.15 · Skylighting.Regex
  • Show REDefined in skylighting-core-0.15 · Skylighting.Regex
  • Binary REDefined in skylighting-core-0.15 · Skylighting.Regex
  • FromJSON REDefined in skylighting-core-0.15 · Skylighting.Regex
  • ToJSON REDefined in skylighting-core-0.15 · Skylighting.Regex

Compile a UTF-8 encoded ByteString as a Regex. If the first parameter is True, then the Regex will be case sensitive. If the second parameter is True, quantifiers are minimal (lazy) rather than greedy by default, and the ? modifier makes them greedy instead of lazy -- this corresponds to PCRE's UNGREEDY option (QRegularExpression's InvertedGreedinessOption, set by minimal="1" in KDE syntax definitions).

Match a Regex against a (presumed UTF-8 encoded) ByteString, returning the matched text and a map of (offset, size) pairs for captures. Note that all matches are from the beginning of the string (a ^ anchor is implicit). As in PCRE, the match returned is the first one that a backtracking matcher would find (leftmost alternatives are preferred), which is not necessarily the longest. Note also that to avoid pathological performance in certain cases, the matcher is limited to considering 2000 possible matches at a time; when that threshold is reached, it discards lower-priority matches. Hence certain regexes may incorrectly fail to match: e.g. a*a{3000}$ on a string of 3000 as.