[wiki-standards] Re: Better Creole Tests?
Radomir Dopieralski
wikistandards at sheep.art.pl
Sat Jul 26 18:40:32 CEST 2008
Sat, Jul 26, 2008 at 12:17:38PM -0400:
> 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.
Um... that's pretty straightforward no? Exactly how you describe:
}}}(?!})
of course it requires a regular expression matcher that supports
lookahead, but those in most modern proggraming languaes do so.
I'm not sure that using tokens in the way you describe is a good
idea in the specific case of wiki markup -- it surely makes a lot
of things more complicated.
--
Radomir `The Sheep' Dopieralski <http://sheep.art.pl>
On and on until we change / Everything remains the same
On and on until we learn / On and on the wheels will turn
More information about the wiki-standards
mailing list