| Haskell Hierarchical Libraries (base package) | Contents | Index

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

:: String | The regular expression to compile
-> Int | Flags (summed together)
-> IO Regex | Returns: the compiled regular expression
Compiles a regular expression

Flags for regcomp
regExtended :: Int
regIgnoreCase :: Int
regNewline :: Int
Matching a regular expression
regexec

:: Regex | Compiled regular expression
-> String | String 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