[wiki-standards] Re: Better Creole Tests?

Michael B Allen ioplex at gmail.com
Sat Jul 26 18:17:38 CEST 2008


On Sat, Jul 26, 2008 at 3:07 AM, Radomir Dopieralski
<wikistandards at sheep.art.pl> wrote:
> Sat, Jul 26, 2008 at 12:09:32AM -0400:
>> On Fri, Jul 25, 2008 at 5:10 PM, Michael B Allen <ioplex at gmail.com> wrote:
>
>> Can anyone suggest a regex to match the last three }}} in a sequence
>> of more than three?
>
> I use something like this (Python):
>
> ur"[{][{][{](?P<code_text>([^}]|[^}][}]|[^}][}][}])*[}]*)[}][}][}]"

This isn't going to help me because I don't match the entire nowiki
block with one regex. I use regex only to tokenize the stream such
that I'm getting tokens '{{{', 'some text', '}}}', '\n', '===', ....

I need a regex that just matches the last occurrence of three closing
curly braces in a sequence of more than three.

One possible way might be to add a regex that matches four closing
braces, outputting one and then pushing the remaining three back onto
the stream. Then, in the next iteration of the loop, if the tokenizer
matches another sequence of four it repeats this (inefficient but
rare) process. If it matches three then that's the nowiki end token.

Mike

-- 
Michael B Allen
PHP Active Directory SPNEGO SSO
http://www.ioplex.com/


More information about the wiki-standards mailing list