Allow to cap the number of pattern