Sky.Core.Regex
Sky.Core.Regex — RE2 regular expressions.
Types
type Regex
type alias Match = { match : String , index : Int , number : Int , submatches : List (Maybe String) }
Values
contains : Regex -> String -> Bool
`contains re s` — does the Regex match anywhere in `s`?
find : Regex -> String -> Maybe String
`find re s` — the first match (Nothing if no match). An empty match is
findAll : Regex -> String -> List String
`findAll re s` — every non-overlapping match in order.
findAllMatches : Regex -> String -> List Match
`findAllMatches re s` — every non-overlapping match, left to right,
findMatch : Regex -> String -> Maybe Match
`findMatch re s` — the first match with its position and its capture
fromString : String -> Result Error Regex
`fromString pattern` — compile an RE2 pattern. An invalid pattern is
match : Regex -> String -> Bool
`match re s` — the same as `contains` (its name before v0.29.0).
never : Regex
A Regex that matches nothing: the usual default for a pattern that did
replace : Regex -> String -> String -> String
`replace re replacement s` — replace every match with `replacement`,
replaceWith : Regex -> (Match -> String) -> String -> String
`replaceWith re f s` — replace every match with `f match`, where `f` sees
split : Regex -> String -> List String
`split re s` — split on every match.