regex-do-2.6.2: PCRE wrapper

Safe HaskellNone
LanguageHaskell2010

Text.Regex.Do.Pcre.Ascii.Match

Description

although sometimes funs in Ascii modules work with non-ascii text (as some examples show), for reliable results with Utf8 pattern or body, use Text.Regex.Do.Pcre.Utf8.Match

see also Text.Regex.Base.RegexLike and Text.Regex.Do.Pcre.Ascii.MatchHint

Synopsis

Documentation

class Match a b out where Source

precompiled Regex may be used as pattern too. see Text.Regex.Do.Pcre.Utf8.Match

See also Text.Regex.Do.Pcre.Ascii.MatchHint

to catch regex construction errors, precompile Regex with makeRegexM or makeRegexOptM

Methods

match :: Pattern a -> Body b -> out Source

Instances

Rx_ a b => Match a b Bool Source

test

>>> "chilly" =~ "it's chilly inside, chilly outside"::Bool

True

Rx_ a b => Match a b [[PosLen]] Source

match all

Rx_ a b => Match a b [PosLen] Source

match once

>>> "à" =~ "tourner à gauche"::[PosLen]

[(8,2)]

Rx_ a b => Match a b [[b]] Source

match all

>>> "chilly" =~ "it's chilly inside, chilly outside"::[[ByteString]]

[["chilly"],["chilly"]]

Rx_ a b => Match a b [b] Source

match once

>>> "^all" =~ "all the time"::[String]

["all"]

(=~) Source

Arguments

:: Match a b out 
=> a

pattern

-> b

body

-> out 

short version of match: arg without newtypes

is borrowed from Text.Regex.PCRE.Wrap

extract :: Extract source => (Int, Int) -> source -> source

extract takes an offset and length and has a default implementation of extract (off,len) source = before len (after off source)

extract is reexport from Text.Regex.Base.RegexLike