This is documentation for Mathematica 6, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

SyntaxQ

SyntaxQ["string"]
returns True if the string corresponds to syntactically correct input for a single Mathematica expression, and returns False otherwise.
Test if a string is valid Mathematica syntax:
In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
When SyntaxQ gives True, the string can be converted to an expression:
In[3]:=
Click for copyable input
Out[3]=
 
Request input from a dialog repeatedly until it is syntactically correct:
New in 2