in reply to Fell off the Llama

The stated answer includes a space between the right paren and the brace, which means that it won't work unless the x is added, like:

/(what) {3}/x
Deleting the space will also work:
/(what){3}/
But it does capture, and it doesn't have to if that is not what's needed - just use non-capturing grouping:
/(?:what){3}/

Replies are listed 'Best First'.
Re^2: Fell off the Llama
by theorbtwo (Prior) on Jun 25, 2004 at 01:43 UTC

    Your answer doesn't quite match the question: "Make a pattern that will match three consecutive copies of whatever is currently contained in $what."

    Your solution fails to match what is contained in $what; it mearly matches the string 'what'.


    Warning: Unless otherwise stated, code is untested. Do not use without understanding. Code is posted in the hopes it is useful, but without warranty. All copyrights are relinquished into the public domain unless otherwise stated. I am not an angel. I am capable of error, and err on a fairly regular basis. If I made a mistake, please let me know (such as by replying to this node).