regex-pcre-0.94.4: Replaces/Enhances Text.Regex

Safe HaskellNone
LanguageHaskell98

Text.Regex.PCRE.String

Contents

Description

This exports instances of the high level API and the medium level API of compile,execute, and regexec.

Synopsis

Types

newtype CompOption #

Constructors

CompOption CInt 

Instances

Eq CompOption # 
Num CompOption # 
Show CompOption # 
Bits CompOption # 
RegexOptions Regex CompOption ExecOption # 

newtype ExecOption #

Constructors

ExecOption CInt 

Instances

Eq ExecOption # 
Num ExecOption # 
Show ExecOption # 
Bits ExecOption # 
RegexOptions Regex CompOption ExecOption # 

Miscellaneous

getVersion :: Maybe String #

return version of pcre used or Nothing if pcre is not available.

Medium level API functions

compile #

Arguments

:: CompOption

Flags (summed together)

-> ExecOption

Flags (summed together)

-> String

The regular expression to compile

-> IO (Either (MatchOffset, String) Regex)

Returns: an error string and offset or the compiled regular expression

Compiles a regular expression

execute #

Arguments

:: Regex

Compiled regular expression

-> String

String to match against

-> IO (Either WrapError (Maybe (Array Int (MatchOffset, MatchLength))))

Returns: Nothing if the regex did not match the string, or: Just an array of (offset,length) pairs where index 0 is whole match, and the rest are the captured subexpressions.

Matches a regular expression against a string

regexec #

Arguments

:: Regex

compiled regular expression

-> String

string to match

-> IO (Either WrapError (Maybe (String, String, String, [String])))

Returns: Nothing if no match, else (text before match, text after match, array of matches with 0 being the whole match)

execute match and extract substrings rather than just offsets

Constants for CompOption

Constants for ExecOption

Orphan instances

RegexLike Regex String # 

Methods

matchOnce :: Regex -> String -> Maybe MatchArray

matchAll :: Regex -> String -> [MatchArray]

matchCount :: Regex -> String -> Int

matchTest :: Regex -> String -> Bool

matchAllText :: Regex -> String -> [MatchText String]

matchOnceText :: Regex -> String -> Maybe (String, MatchText String, String)

RegexContext Regex String String # 

Methods

match :: Regex -> String -> String

matchM :: Monad m => Regex -> String -> m String

RegexMaker Regex CompOption ExecOption String #