lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> > But, and please correct me if I am wrong, but don't lua regexps
> > support multi-byte patterns? Can't you do a (abc)+ to match
> > "abcabcabc" ? [...]
>
> No :-(

The workaround i am using for this is: use a gsub to replace all occurences
of a multibyte pattern with a single byte that you hope doesn't occur
anywhere else in the string: s=gsub(s,'abc','\2')
and then search for this special char: gsub(s,'(\2)+',...)

There is also another thing that is missing in gsub and strfind:
alternatives. ("either-or" matches)

Until those two things are fixed (which they will undoubtedly, sooner or
later :) you might be better off with the rexlib (from the page
http://lua-users.org/wiki/LibrariesAndBindings - but the link seems to be
broken?)

Cheers,
Peter