This is a string that displays as formatted x^2:
"\!\(x \^2 \)"
If I left off the closing parenthesis for example:
"\!\(x \^2 "
Upon evaluation the front end shows a red bracket and a useless message which is simply "The String"
Question is how can we programmatically test for a valid string?
Check doesn't seem to catch it. I'm supposing actually parsing the full string syntax would get pretty involved.
This came up while thinking about this question How to recover "pretty" format after split? by the way.
Edit: example illustrating a valid string where
SyntaxQ will report
"\!\( x \^2 = \)"