sjshuck / hs-pcre2

Complete Haskell binding to PCRE2
Apache License 2.0
12 stars 2 forks source link

Some functions should only return a single match #12

Closed sjshuck closed 3 years ago

sjshuck commented 3 years ago

Under the hood, Matchers are always global, but some functions are intended to produce at most one match.

Currently some functions accidentally return multiple matches in unintended ways that don't make sense given the types. Consider that

 {-# LANGUAGE OverloadedStrings #-}

 module Main where

 import Text.Regex.Pcre2

 main :: IO ()
 main = do
     print $ captures "(\\d)(\\d)" "12345"

prints

["12","1","2","34","3","4"]

but should print

["12","1","2"]
sjshuck commented 3 years ago

This is a bug. Fixing it, and providing better docs, will not cause a major version bump.