Better syntax check exploiting REGEX