yi-language-0.19.2: Collection of language-related Yi libraries.
Safe HaskellNone
LanguageHaskell2010

Yi.Regex

Synopsis

Documentation

data SearchOption Source #

Constructors

IgnoreCase

Compile for matching that ignores char case

NoNewLine

Compile for newline-insensitive matching

QuoteRegex

Treat the input not as a regex but as a literal string to search for.

Instances

Instances details
Binary SearchOption Source # 
Instance details

Defined in Yi.Regex

Generic SearchOption Source # 
Instance details

Defined in Yi.Regex

Associated Types

type Rep SearchOption 
Instance details

Defined in Yi.Regex

type Rep SearchOption = D1 ('MetaData "SearchOption" "Yi.Regex" "yi-language-0.19.2-9aqnsb1TqRMA1LJA09MZJx" 'False) (C1 ('MetaCons "IgnoreCase" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "NoNewLine" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "QuoteRegex" 'PrefixI 'False) (U1 :: Type -> Type)))
Eq SearchOption Source # 
Instance details

Defined in Yi.Regex

type Rep SearchOption Source # 
Instance details

Defined in Yi.Regex

type Rep SearchOption = D1 ('MetaData "SearchOption" "Yi.Regex" "yi-language-0.19.2-9aqnsb1TqRMA1LJA09MZJx" 'False) (C1 ('MetaCons "IgnoreCase" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "NoNewLine" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "QuoteRegex" 'PrefixI 'False) (U1 :: Type -> Type)))

data SearchExp Source #

Instances

Instances details
Binary SearchExp Source # 
Instance details

Defined in Yi.Regex

emptyRegex :: Regex Source #

The regular expression that matches nothing.

regexEscapeString :: String -> String Source #

Return an escaped (for parseRegex use) version of the string.

reversePattern :: (Pattern, (t, DoPa)) -> (Pattern, (t, DoPa)) Source #

Reverse a pattern. Note that the submatches will be reversed as well.

data CompOption Source #

Control whether the pattern is multiline or case-sensitive like Text.Regex and whether to capture the subgroups (\1, \2, etc). Controls enabling extra anchor syntax.

Constructors

CompOption 

Fields

Instances

Instances details
Read CompOption 
Instance details

Defined in Text.Regex.TDFA.Common

Show CompOption 
Instance details

Defined in Text.Regex.TDFA.Common

RegexOptions Regex CompOption ExecOption 
Instance details

Defined in Text.Regex.TDFA.Common

RegexMaker Regex CompOption ExecOption ByteString 
Instance details

Defined in Text.Regex.TDFA.ByteString

RegexMaker Regex CompOption ExecOption ByteString 
Instance details

Defined in Text.Regex.TDFA.ByteString.Lazy

RegexMaker Regex CompOption ExecOption Text

Since: regex-tdfa-1.3.1

Instance details

Defined in Text.Regex.TDFA.Text

RegexMaker Regex CompOption ExecOption Text

Since: regex-tdfa-1.3.1

Instance details

Defined in Text.Regex.TDFA.Text.Lazy

RegexMaker Regex CompOption ExecOption String 
Instance details

Defined in Text.Regex.TDFA.String

RegexMaker Regex CompOption ExecOption (Seq Char) 
Instance details

Defined in Text.Regex.TDFA.Sequence

newtype AllTextSubmatches (f :: Type -> Type) b Source #

Used in results of RegexContext instances.

Constructors

AllTextSubmatches 

Fields

Instances

Instances details
RegexLike a b => RegexContext a b (AllTextSubmatches (Array Int) (b, (MatchOffset, MatchLength))) 
Instance details

Defined in Text.Regex.Base.Context

RegexLike a b => RegexContext a b (AllTextSubmatches (Array Int) b) 
Instance details

Defined in Text.Regex.Base.Context

Methods

match :: a -> b -> AllTextSubmatches (Array Int) b Source #

matchM :: MonadFail m => a -> b -> m (AllTextSubmatches (Array Int) b) Source #

RegexLike a b => RegexContext a b (AllTextSubmatches [] (b, (MatchOffset, MatchLength))) 
Instance details

Defined in Text.Regex.Base.Context

RegexLike a b => RegexContext a b (AllTextSubmatches [] b) 
Instance details

Defined in Text.Regex.Base.Context

Methods

match :: a -> b -> AllTextSubmatches [] b Source #

matchM :: MonadFail m => a -> b -> m (AllTextSubmatches [] b) Source #

class Extract source => RegexLike regex source where Source #

RegexLike is parametrized on a regular expression type and a source type to run the matching on.

There are default implementations: matchTest and matchOnceText use matchOnce; matchCount and matchAllText use matchAll. Conversely, matchOnce uses matchOnceText and matchAll uses matchAllText. So a minimal complete instance need to provide at least (matchOnce or matchOnceText) and (matchAll or matchAllText). Additional definitions are often provided where they will increase efficiency.

[ c | let notVowel = makeRegex "[^aeiou]" :: Regex, c <- ['a'..'z'], matchTest notVowel [c]  ]

"bcdfghjklmnpqrstvwxyz"

The strictness of these functions is instance dependent.

Minimal complete definition

Nothing

Methods

matchAll :: regex -> source -> [MatchArray] Source #

matchAll returns a list of matches. The matches are in order and do not overlap. If any match succeeds but has 0 length then this will be the last match in the list.

matchOnceText :: regex -> source -> Maybe (source, MatchText source, source) Source #

This can return a tuple of three items: the source before the match, an array of the match and captured substrings (with their indices), and the source after the match.

Instances

Instances details
RegexLike Regex ByteString 
Instance details

Defined in Text.Regex.TDFA.ByteString

RegexLike Regex ByteString 
Instance details

Defined in Text.Regex.TDFA.ByteString.Lazy

RegexLike Regex Text

Since: regex-tdfa-1.3.1

Instance details

Defined in Text.Regex.TDFA.Text

RegexLike Regex Text

Since: regex-tdfa-1.3.1

Instance details

Defined in Text.Regex.TDFA.Text.Lazy

RegexLike Regex String 
Instance details

Defined in Text.Regex.TDFA.String

RegexLike Regex (Seq Char) 
Instance details

Defined in Text.Regex.TDFA.Sequence

makeRegex :: RegexMaker regex compOpt execOpt source => source -> regex Source #

makeRegexOptsM :: (RegexMaker regex compOpt execOpt source, MonadFail m) => compOpt -> execOpt -> source -> m regex Source #

Specify your own options, reporting errors with fail

defaultCompOpt :: RegexOptions regex compOpt execOpt => compOpt Source #

Reasonable options (extended, caseSensitive, multiline regex).

defaultExecOpt :: RegexOptions regex compOpt execOpt => execOpt Source #

Reasonable options (extended, caseSensitive, multiline regex).

data Regex Source #

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

Instances

Instances details
RegexLike Regex ByteString 
Instance details

Defined in Text.Regex.TDFA.ByteString

RegexLike Regex ByteString 
Instance details

Defined in Text.Regex.TDFA.ByteString.Lazy

RegexLike Regex Text

Since: regex-tdfa-1.3.1

Instance details

Defined in Text.Regex.TDFA.Text

RegexLike Regex Text

Since: regex-tdfa-1.3.1

Instance details

Defined in Text.Regex.TDFA.Text.Lazy

RegexLike Regex String 
Instance details

Defined in Text.Regex.TDFA.String

RegexContext Regex ByteString ByteString 
Instance details

Defined in Text.Regex.TDFA.ByteString

RegexContext Regex ByteString ByteString 
Instance details

Defined in Text.Regex.TDFA.ByteString.Lazy

RegexContext Regex Text Text

Since: regex-tdfa-1.3.1

Instance details

Defined in Text.Regex.TDFA.Text

Methods

match :: Regex -> Text -> Text Source #

matchM :: MonadFail m => Regex -> Text -> m Text Source #

RegexContext Regex Text Text

Since: regex-tdfa-1.3.1

Instance details

Defined in Text.Regex.TDFA.Text.Lazy

Methods

match :: Regex -> Text -> Text Source #

matchM :: MonadFail m => Regex -> Text -> m Text Source #

RegexContext Regex String String 
Instance details

Defined in Text.Regex.TDFA.String

RegexOptions Regex CompOption ExecOption 
Instance details

Defined in Text.Regex.TDFA.Common

RegexMaker Regex CompOption ExecOption ByteString 
Instance details

Defined in Text.Regex.TDFA.ByteString

RegexMaker Regex CompOption ExecOption ByteString 
Instance details

Defined in Text.Regex.TDFA.ByteString.Lazy

RegexMaker Regex CompOption ExecOption Text

Since: regex-tdfa-1.3.1

Instance details

Defined in Text.Regex.TDFA.Text

RegexMaker Regex CompOption ExecOption Text

Since: regex-tdfa-1.3.1

Instance details

Defined in Text.Regex.TDFA.Text.Lazy

RegexMaker Regex CompOption ExecOption String 
Instance details

Defined in Text.Regex.TDFA.String

RegexMaker Regex CompOption ExecOption (Seq Char) 
Instance details

Defined in Text.Regex.TDFA.Sequence

RegexLike Regex (Seq Char) 
Instance details

Defined in Text.Regex.TDFA.Sequence

RegexContext Regex (Seq Char) (Seq Char) 
Instance details

Defined in Text.Regex.TDFA.Sequence

Methods

match :: Regex -> Seq Char -> Seq Char Source #

matchM :: MonadFail m => Regex -> Seq Char -> m (Seq Char) Source #

(=~) :: (RegexMaker Regex CompOption ExecOption source, RegexContext Regex source1 target) => source1 -> source -> target Source #

This is the pure functional matching operator. If the target cannot be produced then some empty result will be returned. If there is an error in processing, then error will be called.