Put a cap on the number of matches per string and optimise the count (#) operator