Re: Numeric quantifiers

On 07/10/2025 13:08, Bethan Tovey-Walsh wrote:
> No, there's no shortcut to do that in iXML - it's going to have to be 
> repeating the pattern, I'm afraid. I would probably put the pattern in 
> its own suppressed nonterminal (with a very brief name!) and repeat 
> that nonterminal as many times as required. 

Note that if you do this for a range of repeats, e.g. B{2-4}, and expand 
to a simple pattern

    B,B,B?,B?

then you will get correct results for BB and BBBB but ambiguity for BBB 
(3), as the optional pair can match either way for the third B. You'll 
need to make a nested optional part:

    B,B,(B,B?)?

to ensure the third matches only once and a similarly recursively nested 
structure for wider repeat ranges.

-- 
*John Lumley* MA PhD CEng FIEE
john@saxonica.com

Received on Tuesday, 7 October 2025 12:18:49 UTC