write a regex expression that find graphql queries or mutations in a file
- User
write a regex expression that find graphql queries or mutations in a file
- Assistant
Here is a regular expression (regex) pattern that can be used to find GraphQL queries or mutations in a file:
regex/\b(query|mutation)\b[\s\S]*?\{[\s\S]*?\}/gThis pattern uses word boundaries (\b) to ensure that only complete words "query" or "mutation" are matched, and it uses a non-greedy wildcard match ([\s\S]*?) to capture the entire query or mutation block, including the curly braces. The g flag at the end of the pattern enables global matching, which allows multiple queries or mutations to be matched within the same file.
This is a basic pattern that can be customized to match the specific syntax of your GraphQL queries or mutations, if necessary.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Identical first prompt
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →