On Mon, 9 Nov 2009 05:53:00 -0800 (PST), pinkisntwell <pinkisntw...@gmail.com> 
wrote:

>How can I make a regular expression that will match every occurrence
>of a group and return each occurrence as a group match? For example,
>for a string "-c-c-c-c-c", how can I make a regex which will return a
>group match for each occurrence of "-c"?

Is this a ludicrous question, or is it meant for the python group?

use strict;
use warnings;

my @matches = "-c-c-c-c-c" =~ /(-c)/g;
print "\...@matches\n";

@matches = ();
"-c-a-c-c-c" =~ /(?:(-c)(?{push @matches, $^N})|.)+/x;
print "@matches\n";

-sln
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to