fix: use precompiled regexes to handle case insensitivity correctly
This commit is contained in:
parent
31dc8a090e
commit
7482f1efc3
@ -78,8 +78,7 @@ import qualified Data.Text as T
|
|||||||
import Text.Regex.TDFA (
|
import Text.Regex.TDFA (
|
||||||
Regex, CompOption(..), defaultCompOpt, defaultExecOpt,
|
Regex, CompOption(..), defaultCompOpt, defaultExecOpt,
|
||||||
makeRegexOptsM, AllMatches(getAllMatches), match, MatchText,
|
makeRegexOptsM, AllMatches(getAllMatches), match, MatchText,
|
||||||
RegexLike(..), RegexMaker(..), RegexOptions(..), RegexContext(..),
|
RegexLike(..), RegexMaker(..), RegexOptions(..), RegexContext(..)
|
||||||
(=~)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -179,8 +178,8 @@ regexMatchText r = matchTest r . T.unpack
|
|||||||
-- Regex to a Text.
|
-- Regex to a Text.
|
||||||
regexMatchTextGroups :: Regexp -> Text -> [Text]
|
regexMatchTextGroups :: Regexp -> Text -> [Text]
|
||||||
regexMatchTextGroups r txt = let
|
regexMatchTextGroups r txt = let
|
||||||
pat = reString r
|
pat = reCompiled r
|
||||||
(_,_,_,matches) = txt =~ pat :: (Text,Text,Text,[Text])
|
(_,_,_,matches) = match pat txt :: (Text,Text,Text,[Text])
|
||||||
in matches
|
in matches
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user