Safe Haskell | None |
---|---|
Language | Haskell98 |
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 -> Seq Char -> IO (Either (MatchOffset, String) Regex)
- execute :: Regex -> Seq Char -> IO (Either WrapError (Maybe (Array Int (MatchOffset, MatchLength))))
- regexec :: Regex -> Seq Char -> IO (Either WrapError (Maybe (Seq Char, Seq Char, Seq Char, [Seq Char])))
- 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
A compiled regular expression
Instances
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 Source #
Instances
newtype ExecOption Source #
Instances
data ReturnCode Source #
Instances
Eq ReturnCode Source # | |
Defined in Text.Regex.PCRE.Wrap (==) :: ReturnCode -> ReturnCode -> Bool # (/=) :: ReturnCode -> ReturnCode -> Bool # | |
Show ReturnCode Source # | |
Defined in Text.Regex.PCRE.Wrap showsPrec :: Int -> ReturnCode -> ShowS # show :: ReturnCode -> String # showList :: [ReturnCode] -> ShowS # |
type WrapError = (ReturnCode, String) Source #
Miscellaneous
getVersion :: Maybe String Source #
return version of pcre used or Nothing if pcre is not available.
Medium level API functions
:: CompOption | Flags (summed together) |
-> ExecOption | Flags (summed together) |
-> Seq Char | 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
:: Regex | Compiled regular expression |
-> Seq Char | (Seq Char) to match against |
-> IO (Either WrapError (Maybe (Array Int (MatchOffset, MatchLength)))) | Returns: |
Matches a regular expression against a string
:: Regex | compiled regular expression |
-> Seq Char | string to match |
-> IO (Either WrapError (Maybe (Seq Char, Seq Char, Seq Char, [Seq Char]))) | 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
RegexMaker Regex CompOption ExecOption (Seq Char) Source # | |
makeRegex :: Seq Char -> Regex # makeRegexOpts :: CompOption -> ExecOption -> Seq Char -> Regex # makeRegexM :: Monad m => Seq Char -> m Regex # makeRegexOptsM :: Monad m => CompOption -> ExecOption -> Seq Char -> m Regex # | |
RegexLike Regex (Seq Char) Source # | |
matchOnce :: Regex -> Seq Char -> Maybe MatchArray # matchAll :: Regex -> Seq Char -> [MatchArray] # matchCount :: Regex -> Seq Char -> Int # matchTest :: Regex -> Seq Char -> Bool # matchAllText :: Regex -> Seq Char -> [MatchText (Seq Char)] # matchOnceText :: Regex -> Seq Char -> Maybe (Seq Char, MatchText (Seq Char), Seq Char) # | |
RegexContext Regex (Seq Char) (Seq Char) Source # | |