Safe Haskell | Safe-Inferred |
---|
More user friendly regex api for PCRE regexes.
Synopsis
- data Regex
- data Option
- compile :: String -> Either String Regex
- compileOptions :: [Option] -> String -> Either String Regex
- compileUnsafe :: Stack.HasCallStack => String -> Regex
- compileOptionsUnsafe :: Stack.HasCallStack => [Option] -> String -> Regex
- matches :: Regex -> Text -> Bool
- groups :: Regex -> Text -> [(Text, [Text])]
- groupRanges :: Regex -> Text -> [((Int, Int), [(Int, Int)])]
- substitute :: Regex -> Text -> Text -> Text
- substituteGroups :: Regex -> (Text -> [Text] -> Text) -> Text -> Text
- escape :: String -> String
Documentation
An abstract pointer to a compiled PCRE Regex structure The structure allocated by the PCRE library will be deallocated automatically by the Haskell storage manager.
compile
compileUnsafe :: Stack.HasCallStack => String -> Regex Source #
Will throw a runtime error if the regex has an error!
compileOptionsUnsafe :: Stack.HasCallStack => [Option] -> String -> Regex Source #
Will throw a runtime error if the regex has an error!
matching
Half-open ranges of where the regex matches.
substitute
substitute :: Regex -> Text -> Text -> Text Source #
TODO this is not the usual thing where it replaces 1 2 etc., but it replaces the entire match.