Fix regular expression for syntax error detection