Re: Matching a fixed number of repetitions in LPeG
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Matching a fixed number of repetitions in LPeG
- From: Peter Cawley <lua@...>
- Date: 2012年6月19日 21:59:19 +0100
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)