Safe Haskell | None |
---|---|
Language | Haskell2010 |
The basic use of this module is to first parse a regular expression string (like "[mn]{2,5}[eio]+s?"
) into an Anagrex
with makeAnagrex
.
This can then be used to efficiently test candidate strings with testAnagrex
.
Documentation
A compiled regular expression pattern to match anagrams.
Represented as an (expanded) list of alternative AnaPat
s.
Instances
Show Anagrex Source # | |
IsString Anagrex Source # | |
Defined in Text.Regex.Anagram.Compile fromString :: String -> Anagrex # | |
FoldCase Anagrex Source # | Used to create a case-insensitive version of a pattern.
Note that this involves a re-compilation of the parsed |
Defined in Text.Regex.Anagram.Compile | |
NFData Anagrex Source # | |
Defined in Text.Regex.Anagram.Compile |
makeAnagrex :: String -> Either String Anagrex Source #
Build a regular expression for matching anagrams from a string, returning Left
error for invalid or unsupported regular expressions.
(Uses parseRegex
.)
This works by first expanding out a list of alternative patterns (like "a|(b(c|d))"
into ["a","bc","bd"]
) and then creating optimized pattern represenations for each.