regex-pcre-builtin-0.94.4.8.8.35: Replaces/Enhances Text.Regex

Safe Haskell | None
Language | Haskell98

Text.Regex.PCRE.ByteString

Contents

- Types
- Miscellaneous
- Medium level API functions
- CompOption flags
- ExecOption flags

Description

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

Synopsis

- data Regex
- type MatchOffset = Int
- type MatchLength = Int
- newtype CompOption = CompOption CInt
- newtype ExecOption = ExecOption CInt
- data ReturnCode
- type WrapError = (ReturnCode, String)
- unusedOffset :: MatchOffset
- getVersion :: Maybe String
- compile :: CompOption -> ExecOption -> ByteString -> IO (Either (MatchOffset, String) Regex)
- execute :: Regex -> ByteString -> IO (Either WrapError (Maybe (Array Int (MatchOffset, MatchLength))))
- regexec :: Regex -> ByteString -> IO (Either WrapError (Maybe (ByteString, ByteString, ByteString, [ByteString])))
- compBlank :: CompOption
- compAnchored :: CompOption
- compAutoCallout :: CompOption
- compCaseless :: CompOption
- compDollarEndOnly :: CompOption
- compDotAll :: CompOption
- compExtended :: CompOption
- compExtra :: CompOption
- compFirstLine :: CompOption
- compMultiline :: CompOption
- compNoAutoCapture :: CompOption
- compUngreedy :: CompOption
- compUTF8 :: CompOption
- compNoUTF8Check :: CompOption
- execBlank :: ExecOption
- execAnchored :: ExecOption
- execNotBOL :: ExecOption
- execNotEOL :: ExecOption
- execNotEmpty :: ExecOption
- execNoUTF8Check :: ExecOption
- execPartial :: ExecOption

## Types

data Regex

A compiled regular expression

Instances

RegexLike Regex String |
RegexLike Regex ByteString |
RegexLike Regex ByteString |
RegexOptions Regex CompOption ExecOption |
RegexContext Regex String String |
RegexContext Regex ByteString ByteString |
RegexContext Regex ByteString ByteString |
RegexMaker Regex CompOption ExecOption String |
RegexMaker Regex CompOption ExecOption ByteString |
RegexMaker Regex CompOption ExecOption ByteString |
RegexMaker Regex CompOption ExecOption (Seq Char) |
RegexLike Regex (Seq Char) |
RegexContext Regex (Seq Char) (Seq Char) |

type MatchOffset = Int

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

type MatchLength = Int

non-negative length of a match

newtype CompOption

Constructors

CompOption CInt |

Instances

Eq CompOption |
Num CompOption |
Show CompOption |
Bits CompOption |
RegexOptions Regex CompOption ExecOption |
RegexMaker Regex CompOption ExecOption String |
RegexMaker Regex CompOption ExecOption ByteString |
RegexMaker Regex CompOption ExecOption ByteString |
RegexMaker Regex CompOption ExecOption (Seq Char) |

newtype ExecOption

Constructors

ExecOption CInt |

Instances

Eq ExecOption |
Num ExecOption |
Show ExecOption |
Bits ExecOption |
RegexOptions Regex CompOption ExecOption |
RegexMaker Regex CompOption ExecOption String |
RegexMaker Regex CompOption ExecOption ByteString |
RegexMaker Regex CompOption ExecOption ByteString |
RegexMaker Regex CompOption ExecOption (Seq Char) |

data ReturnCode

Instances

Eq ReturnCode |
Show ReturnCode |

type WrapError = (ReturnCode, String)

## Miscellaneous

unusedOffset :: MatchOffset

getVersion :: Maybe String

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

## Medium level API functions

compile

Arguments

:: CompOption | (summed together)
-> ExecOption | (summed together)
-> ByteString | The regular expression to compile
-> IO (Either (MatchOffset, String) Regex) | Returns: the compiled regular expression

Compiles a regular expression

execute

Arguments

:: Regex | Compiled regular expression
-> ByteString | 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 buffer, returning the buffer indicies of the match, and any submatches

| Matches a regular expression against a string

regexec

Arguments

:: Regex | Compiled regular expression
-> ByteString | String to match against
-> IO (Either WrapError (Maybe (ByteString, ByteString, ByteString, [ByteString]))) |

## CompOption flags

compBlank :: CompOption

compAnchored :: CompOption

compAutoCallout :: CompOption

compCaseless :: CompOption

compDollarEndOnly :: CompOption

compDotAll :: CompOption

compExtended :: CompOption

compExtra :: CompOption

compFirstLine :: CompOption

compMultiline :: CompOption

compNoAutoCapture :: CompOption

compUngreedy :: CompOption

compUTF8 :: CompOption

compNoUTF8Check :: CompOption

## ExecOption flags

execBlank :: ExecOption

execAnchored :: ExecOption

execNotBOL :: ExecOption

execNotEOL :: ExecOption

execNotEmpty :: ExecOption

execNoUTF8Check :: ExecOption

execPartial :: ExecOption