matching a pattern at least thrice