[Haskell-cafe] Text.Regex.matchRegex: Success is empty?

Adam Bergmark adam at bergmark.nl
Tue Apr 5 20:24:59 UTC 2016

The regex-compat docs say "




 if the match succeeded (and 


 is the list of subexpression matches), or 





Adam Bergmark

On Tue 05 Apr 2016 at 22:16 Jeffrey Brown

mailto:Jeffrey Brown <jeffbrown.the at gmail.com>
> wrote:

Esteemed Haskellers,

It is working for me, but I am puzzled by the matchRegex function:

    > import Text.Regex

    > :i matchRegex

    matchRegex :: Regex -> String -> Maybe [String]

            -- Defined in ‘Text.Regex’

Searches that fail return Nothing:

    > matchRegex (mkRegex "z") "abracadabra"


which makes sense. But why do searches that succeed return an empty list of Strings?

    > matchRegex (mkRegex "a") "abracadabra"

    Just []



Jeffrey Benjamin Brown


Haskell-Cafe mailing list
mailto:Haskell-Cafe at haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20160405/e80e66d3/attachment.html>

More information about the Haskell-Cafe mailing list