[validator] Fix tabbing, compile regexes, tidy code