'Regex for GraphQL - is it possible?
In the same vein as Regex to Validate JSON, for reasons of pure interest and novelty, I am looking for a regex to validate that a string containing a GraphQL-query is syntactically valid.
I know there are loads of libraries that will allow me to validate GraphQL in different languages, but I am specifically looking for a solution using Regular Expressions.
Have anyone cracked the case of a regular expression that can determine whether a string has valid GraphQL query syntax - as per the latest spec from spec.graphql.org?
Solution 1:[1]
This is not possible. With the arbitrary nesting, GraphQL query syntax is not a regular language and cannot be matched with regular expressions.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Bergi |
