Re:pattern help

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Re:pattern help
I'd suggest

for word in string.gfind('ThisIsAnExample', '%u%l+') do
  -- do something with word

Not tested, i hope it works as you expect.

> Hi,
> I'm trying to write a pattern that matches any string t
hat is a sequence of 
> initial caps words. eg ThisIsAnExample
> This is for a toy wiki I'm constructing in lua. I curre
ntly have (%u%l+%u%l) 
> which matches TwoWord examples, but I cant work out how
 to repeat the 
> sequence. I had thought (%u%l+)
+ might work, but I'm not sure what that will 
> give.
> I'd also like to know in a more general sense how to ma
tch repeated patterns 
> eg. how would I match any length sequence of numberUppe
> eg. 1Yl and 1Aa4Bb9Cc
> thanks,
> Rob

Acabe com aquelas janelinhas que pulam na sua tela.
AntiPop-up UOL - É grátis!