Use lookahead match.  Without the inner () it doesn't capture the group so we can test which one it found.