\b(\d)\1+\b Explanation: \b # match word boundary (\d) # match digit remember it \1+ # match one or more instances of the previously matched digit \b # match word boundary