in reply to Finding number of 'k'-clique in a graph
The trick is to include some code that runs when you've found a match, and then cause the whole expression to fail, so that it backtracks to try again.
I've told it to match the beginning of string after it executes my code. That's an impossible match, so the regex goes back and tries again.$_ = '11 22 33 44'; /\b\d+ \d+ \d+\b(?{print "$&\n"})^/;
|
|---|