[plt-scheme] pregexp.ss multiple matches (something)*

From: Dave Gurnell (d.j.gurnell at gmail.com)
Date: Mon Oct 8 02:48:10 EDT 2007

Hi Cyprien,

Addressing your problem:

   See if pregexp-split suits your needs.

Addressing pregexp-match in general:

   I've had this problem with Perl regexps before (in the PHP  
   as well as the PLT one). I don't know what the correct behaviour  
is. Does
   anyone else out there know?

-- Dave

> I'm trying to make multiples matches using pregexp-match within
> pregexp.ss library.
> I would like to match the same pattern n times and to keep all the
> results as a list.
> I don't know if my explanation is clear, so here is an example with
> comma-separated values
> (require (lib "pregexp.ss"))
> (pregexp-match "^(\\d+)(?:[., ](\\d+))*$" "123,456,789,010")
> The result is ("123,456,789" "123" "010")
> And I would like to get ("123,456,789" "123" "456" "789" "010")
> I only get the last matched text.
> That behavior is not explained in the documention, is that a bug ?
> I that example it will be easier to use pregexp-split, but the text I
> want to match is a little more complex than CSV.

Posted on the users mailing list.