in reply to Re^4: How can I access the number of repititions in a regex?
in thread How can I access the number of repititions in a regex?

It sounds like you want something like this:
for ('aabbbbbc', 'abccc', 'aabcc', 'aaacccc', 'abc') { print length $1, length $2, length $3, "\n" if /(a+)(b+)(c+)/; }
Though I never would have guessed that's what you were looking for from your initial post. If that doesn't do it, maybe you should post some of the actual data your dealing with and your expected output. -driver8

Replies are listed 'Best First'.
Re^6: How can I access the number of repititions in a regex?
by pat_mc (Pilgrim) on Dec 18, 2008 at 14:51 UTC
    Good idea, driver8 -

    The only limitation of this solution being that it only works for match strings of length 1. Also, the result of the number of matches is only available outside the regex.

    What I would like to have is a regex that can extract something like "give me all matches containing one more 'b' than 'a's".

    abb matches
    aabbb matches
    aabb does not match

    I think we need a code evaluation expression to solve this, so something along the lines suggested by grizley below.

    Thanks for your input!

    Cheers -

    Pat