Karya, built on 2020-11-26T21:03:17 (patch 23b5be2d53a9e8e7d6136cda5aae2849abe5cded)
Safe HaskellNone

Util.Regex

Description

More user friendly regex api for PCRE regexes.

Synopsis

Documentation

data Regex #

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.

Instances

Instances details
Eq Regex 
Instance details

Defined in Text.Regex.PCRE.Light.Base

Methods

(==) :: Regex -> Regex -> Bool #

(/=) :: Regex -> Regex -> Bool #

Ord Regex 
Instance details

Defined in Text.Regex.PCRE.Light.Base

Methods

compare :: Regex -> Regex -> Ordering #

(<) :: Regex -> Regex -> Bool #

(<=) :: Regex -> Regex -> Bool #

(>) :: Regex -> Regex -> Bool #

(>=) :: Regex -> Regex -> Bool #

max :: Regex -> Regex -> Regex #

min :: Regex -> Regex -> Regex #

Show Regex 
Instance details

Defined in Text.Regex.PCRE.Light.Base

Methods

showsPrec :: Int -> Regex -> ShowS #

show :: Regex -> String #

showList :: [Regex] -> ShowS #

compile

data Option Source #

Instances

Instances details
Eq Option # 
Instance details

Defined in Util.Regex

Methods

(==) :: Option -> Option -> Bool #

(/=) :: Option -> Option -> Bool #

Ord Option # 
Instance details

Defined in Util.Regex

Show Option # 
Instance details

Defined in Util.Regex

compileUnsafe :: CallStack.Stack => String -> Regex Source #

Will throw a runtime error if the regex has an error!

compileOptionsUnsafe :: CallStack.Stack => [Option] -> String -> Regex Source #

Will throw a runtime error if the regex has an error!

matching

groups :: Regex -> Text -> [(Text, [Text])] Source #

Return (complete_match, [group_match]).

groupRanges Source #

Arguments

:: Regex 
-> Text 
-> [((Int, Int), [(Int, Int)])]

(entire, [group])

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.

substituteGroups Source #

Arguments

:: Regex 
-> (Text -> [Text] -> Text)

(complete_match -> groups -> replacement)

-> Text 
-> Text 

misc

escape :: String -> String Source #

Escape a string so the regex matches it literally.