lua-users home
lua-l archive

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


On Tue, Jun 19, 2012 at 9:55 PM, Hinrik Örn Sigurðsson
<hinrik.sig@gmail.com> wrote:
> Thanks, that works. How about when you need to specify both minimum
> and maximum repetitions? E.g. like /\w{3,10}/ in Perl.

You've gotten patt^-N for between 0 and N repetitions of patt. Combine
it with a fixed power to get an arbitrary range:

power(patt, min) * patt^(min-max)