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"?

Where is the problem? The most straight-forward, simplest approach works
just fine:
        use strict; use warnings;
        my $s = '-c-c-c-c-c';

        my @matched = $s=~/-c/g;

        print "Found ". @matched . " occurences of '-c':\n";
        print join "\n", @matched;

Or did you forget to use the g modifier?

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

Reply via email to