if (! /([smtwhfa])(?=.*?\1)/) { | | | | | +----- followed by this character | +--------------- find any of these characters +-------------------- but take the negative of the match