/^ # anchored to the beginning of the string \w+ # one or more word characters (a word) \s* # zero or more whitespace characters = # an equals sign \s* # zero or more whitespace characters \w+ # one or more word characters (a word) \s* # zero or more whitespace characters \, # a comma (you actually don't need to backslash this) \? # a question mark \w+ # one or more word characters (a word) /x;