Novah Documentation

novah.regex

Functions to work with regular expressions.

Types

Declarations


new

visibility: public
type: String -> Pattern

Compiles this string into a regular expression.


withFlags

visibility: public
type: String -> Int32 -> Pattern

Compiles this string and flags into a regular expression.


matcher

visibility: public
type: Pattern -> String -> Matcher

Returns a matcher for the given regex and string.


resultToGroups

visibility: private
type: MatchResult -> List String

groups

visibility: public
type: Matcher -> List String

Returns a list of all matched groups for the most recent match on this matcher. The first element represents the whole match.


find

visibility: public
type: Pattern -> String -> List String

Returns the first match of this regex for the given string. Returns an empty list if there was no match.


findAll

visibility: public
type: Pattern -> String -> List (List String)

Returns all the matches of this regex for the given string. Returns an empty list if there was no match.


canFind

visibility: public
type: Pattern -> String -> Boolean

Returns true if there is at least one match of this pattern in the given string.


matches

visibility: public
type: Pattern -> String -> Boolean

Returns true if this regex matches the whole input string.


split

visibility: public
type: Pattern -> String -> List String

Splits this string around matches of this pattern.


replaceFirst

visibility: public
type: Pattern -> String -> String -> String

Replaces the first occurrence of this regex with the given replacement.


replaceAll

visibility: public
type: Pattern -> String -> String -> String

Replaces all occurrences of this regex with the given replacement.


replaceFirstWith

visibility: public
type: Pattern -> (List String -> String) -> String -> String

Replaces the first occurrence of this regex with the application of the given function to the match result.


replaceAllWith

visibility: public
type: Pattern -> (List String -> String) -> String -> String

Replaces all occurrences of this regex with the application of the given function to the match result.