Closed m-ender closed 6 years ago
This has been added for Retina 1.0. You can either give a loop stage an integer parameter (technically syntax abuse of limits, but well...), which will run the loop that many times, or you can give it a string parameter which is then used as a substitution for matching \A(?s:.*)\z
against the input, and the loop count is parsed from the result. The substitution will usually either access the history or be an expression based on the match length $.&
. The sign of the iteration count will be used to determine whether the loop still terminates when the string stops changing.
I have no good solution for this yet, but Retina could really use a way to repeat any stage or group of stages
N
times, whereN
is either read from the string, a match or a substitution.