Haskell Hierarchical Libraries (base package)ContentsIndex
Text.Regex.Posix
Portability non-portable (needs POSIX regexps)
Stability experimental
Maintainer libraries@haskell.org
Contents
The Regex type
Compiling a regular expression
Flags for regcomp
Matching a regular expression
Description
Interface to the POSIX regular expression library.
Synopsis
data Regex
regcomp :: String -> Int -> IO Regex
regExtended :: Int
regIgnoreCase :: Int
regNewline :: Int
regexec :: Regex -> String -> IO (Maybe (String, String, String, [String]))
The Regex type
data Regex
A compiled regular expression
Compiling a regular expression
regcomp
:: StringThe regular expression to compile
-> IntFlags (summed together)
-> IO RegexReturns: the compiled regular expression
Compiles a regular expression
Flags for regcomp
regExtended :: Int
regIgnoreCase :: Int
regNewline :: Int
Matching a regular expression
regexec
:: RegexCompiled regular expression
-> StringString to match against
-> IO (Maybe (String, String, String, [String]))

Returns: Nothing if the regex did not match the string, or:

Just (everything before match,
matched portion,
everything after match,
subexpression matches)
Matches a regular expression against a string
Produced by Haddock version 0.6