Safe Haskell | None |
---|---|
Language | Haskell2010 |
Easy regular expression helpers, based on regex-tdfa and (a little) on regexpr. These should:
- be cross-platform, not requiring C libraries
- support unicode
- support extended regular expressions
- support replacement, with backreferences etc.
- support splitting
- have mnemonic names
- have simple monomorphic types
- work with strings
Current limitations:
- (?i) and similar are not supported
- type Regexp = String
- type Replacement = String
- regexMatches :: Regexp -> String -> Bool
- regexMatchesCI :: Regexp -> String -> Bool
- regexReplace :: Regexp -> Replacement -> String -> String
- regexReplaceCI :: Regexp -> Replacement -> String -> String
- regexReplaceBy :: Regexp -> (String -> String) -> String -> String
- regexReplaceByCI :: Regexp -> (String -> String) -> String -> String
- regexSplit :: Regexp -> String -> [Regexp]
type aliases
Regular expression. Extended regular expression-ish syntax ? But does not support eg (?i) syntax.
type Replacement = String Source
A replacement pattern. May include numeric backreferences (N).
based on regex-tdfa
regexMatches :: Regexp -> String -> Bool Source
regexMatchesCI :: Regexp -> String -> Bool Source
regexReplace :: Regexp -> Replacement -> String -> String Source
Replace all occurrences of the regexp with the replacement pattern. The replacement pattern supports numeric backreferences (N) but no other RE syntax.
regexReplaceCI :: Regexp -> Replacement -> String -> String Source
regexReplaceBy :: Regexp -> (String -> String) -> String -> String Source
Replace all occurrences of the regexp, transforming each match with the given function.
based on regexpr
regexSplit :: Regexp -> String -> [Regexp] Source