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

Safe HaskellNone

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

type MatchOffset = Int

0 based index from start of source, or (-1) for unused

type MatchLength = Int

non-negative length of a match

Miscellaneous

getVersion :: Maybe StringSource

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

Medium level API functions

compileSource

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

executeSource

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

regexecSource

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