Wraps Javascript's RegExp object that enables matching strings with
patternes defined by regular expressions.
For details of the underlying implementation, see RegExp Reference at MDN.
data Regex :: *Wraps Javascript RegExp objects.
instance showRegex :: Show Regextype RegexFlags = { global :: Boolean, ignoreCase :: Boolean, multiline :: Boolean, sticky :: Boolean, unicode :: Boolean }Flags that control matching.
noFlags :: RegexFlagsAll flags set to false.
regex :: String -> RegexFlags -> RegexConstructs a Regex from a pattern string and flags.
source :: Regex -> StringReturns the pattern string used to construct the given Regex.
flags :: Regex -> RegexFlagsReturns the RegexFlags used to construct the given Regex.
renderFlags :: RegexFlags -> StringReturns the string representation of the given RegexFlags.
parseFlags :: String -> RegexFlagsParses the string representation of RegexFlags.
test :: Regex -> String -> BooleanReturns true if the Regex matches the string.
match :: Regex -> String -> Maybe (Array (Maybe String))Matches the string against the Regex and returns an array of matches
if there were any. Each match has type Maybe String, where Nothing
represents an unmatched optional capturing group.
See reference.
replace :: Regex -> String -> String -> StringReplaces occurences of the Regex with the first string. The replacement
string can include special replacement patterns escaped with "$".
See reference.
replace' :: Regex -> (String -> Array String -> String) -> String -> StringTransforms occurences of the Regex using a function of the matched
substring and a list of submatch strings.
See the reference.
search :: Regex -> String -> Maybe IntReturns Just the index of the first match of the Regex in the string,
or Nothing if there is no match.
split :: Regex -> String -> Array StringSplit the string into an array of substrings along occurences of the Regex.