-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Jim Wilson wrote:
Any advice on how to handle these edge cases (nested brackets beyond 2 or 3) would be much appreciated.
Ewwwww :)
Generally these sort of things get handled by what closes first, with longest match first.
So for quadruple {{{{a}}}}
we have: - - starting sequence string: {{{{ - - text: a - - found possible ending sequence: }}} - - found starting match: {{{, leaving { prefix - - found leftover }
Thus splitting up into: - - text: { - - template param start sequence: {{{ - text: a - template param end sequence: }}} - - text: }
I dunno if that always gives the intuitively "right" answer, though.
- -- brion vibber (brion @ wikimedia.org)