Allow pattern repeat count to be a generator