`([\d]+), \1((?:\W|$))` ``` ^ : Start anchor ( : Start of capturing group \w+ : A word ) : End of capturing group \s+ : One or more whitespace \1 : Back reference to the first word \b : Word boundary ``` link: http://stackoverflow.com/questions/4843582/regular-expression-to-check-if-two-first-words-are-same