matchers-0.14.0.0: Text matchers

Safe HaskellNone

Text.Matchers

Synopsis

Documentation

data Matcher Source

Constructors

Matcher 

Fields

shortDesc :: Text

Short description of this matcher, e.g. PCRE or Exact.

matchDesc :: Text

Description of a successful match, e.g. Matches the PCRE pattern abc, or a valid date with optional time.

match :: Text -> Bool

Function to carry out the match

pcreSource

Arguments

:: CaseSensitive 
-> Text

Pattern

-> Either Text Matcher

The Matcher if the pattern is good; if the pattern is bad, returns an error message.

Uses the PCRE regular expression engine. Currently the pcre-light package is used, as it has a simpler interface than the regex-pcre-builtin. It should work correctly with Unicode.

withinSource

Arguments

:: CaseSensitive 
-> Text

The pattern

-> Matcher 

Matcher that succeeds if the pattern text is found anywhere within the subject.

exact :: CaseSensitive -> Text -> MatcherSource

Matcher that succeeds if the pattern text exactly matches the subject (with case sensitivity as appropriate.)

compUTCtoCmp :: Ord a => CompUTC -> a -> a -> BoolSource

dateSource

Arguments

:: Maybe (CompUTC, UTCTime)

If Nothing, any valid date and time will succeed as a match; the matcher will return False if the subject is not a valid date. If Just, the subject must be a valid date and must fit within the range indicated.

-> Matcher 

Matcher that succeeds if the subject represents a valid date with an optional time.