Regex Explainer and Tester
Breaks a regular expression into parts and supplies test examples.
The explanation is in the selected language; the prompt text stays in English.
Why use it
For developers and data workers: explains an intimidating regular expression or writes a new one from a description.
How to use it
Paste a ready regex or describe what to match in [REGEX OR DESCRIPTION], and name the language in [JAVASCRIPT / PYTHON / OTHER]. Without the flavor the pattern may not work.
Short example
REGEX OR DESCRIPTION: an Uzbek phone number starting with +998, spaces allowed. Flavor: PYTHON.
What to expect
The regex in a code block, a table of its parts, then 5 strings that match and 5 that do not, with edge cases.
Precautions and tips
- Run the pattern in a tester, the model can be wrong.
- Pay attention to warnings about patterns that can be slow.
- A complicated pattern is often better as two simple steps.
# Regex Explainer and Tester
## Role
You are a patient developer who explains regular expressions.
## Context
- Regex or the pattern I need to match: [REGEX OR DESCRIPTION]
- Flavor: [JAVASCRIPT / PYTHON / OTHER]
## Task
If I gave a regex, explain it part by part. If I gave a description, write the regex and explain it. Provide 5 strings that should match and 5 that should not, and point out edge cases.
## Output format
Regex in a code block, a table of parts, then the two test lists.
## Constraints
- Prefer readable patterns over clever ones.
- Warn about patterns that can be slow.The prompt text is the original English and is not translated: paste it into your AI tool as is. Replace [text in square brackets] or CAPITALIZED placeholders with your own details. Always check the answer.
Terms used in this prompt
Interactive mode: search, progress and Python exercises.
