darcs-2.18.5: a distributed, interactive, smart revision control system

Safe Haskell | None
Language | Haskell2010

Darcs.Util.Regex

Description

This module is a subset of the defunct regex-compat-tdfa.

Synopsis

- data Regex
- mkRegex :: String -> Regex
- mkRegexWithOpts :: String -> Bool -> Bool -> Regex
- matchRegex :: Regex -> String -> Maybe [String]

# Documentation

data Regex #

The TDFA backend specific `Regex` type, used by this module's `RegexOptions` and `RegexMaker`.

#### Instances

Instances details

RegexOptions Regex CompOption ExecOption |
Instance details Defined in Text.Regex.TDFA.Common Methods blankCompOpt :: CompOption # blankExecOpt :: ExecOption # defaultCompOpt :: CompOption # defaultExecOpt :: ExecOption # setExecOpts :: ExecOption -> Regex -> Regex # getExecOpts :: Regex -> ExecOption #

mkRegex :: String -> Regex #

Makes a regular expression with the default options (multi-line, case-sensitive). The syntax of regular expressions is otherwise that of `egrep` (i.e. POSIX "extended" regular expressions).

mkRegexWithOpts #

Arguments

:: String | The regular expression to compile
-> Bool | `True` `<=>` `'^'` and `'$'` match the beginning and end of individual lines respectively, and `'.'` does not match the newline character.
-> Bool | `True` `<=>` matching is case-sensitive
-> Regex | Returns: the compiled regular expression

Makes a regular expression, where the multi-line and case-sensitive options can be changed from the default settings.

matchRegex #

Arguments

:: Regex | The regular expression
-> String | The string to match against
-> Maybe [String] | Returns: ``Just` strs` if the match succeeded (and `strs` is the list of subexpression matches), or `Nothing` otherwise.

Match a regular expression against a string