Write thorough unit tests for a function
Generate a well-organized test suite covering happy paths, edge cases and failure modes for code you paste in.
Describe what you want to match and get a commented regex with matching and non-matching test cases.
Build a regular expression for this task.
What it should match: {{goal}}
Regex flavor: {{flavor}}
Examples that MUST match:
{{should_match}}
Examples that must NOT match:
{{should_not_match}}
Deliver:
1. The regex on its own line, in a code block, ready to paste.
2. A token-by-token breakdown in a table (part, meaning).
3. A test table covering every example I gave plus at least 6 more you invent, including tricky edge cases. For each row show the input, expected result and why. Walk through each case carefully so the table is correct for this flavor.
4. Known limits: what it intentionally does not handle, catastrophic backtracking risks, and anything better done with a parser or a validation library instead.
5. A usage snippet showing how to apply it with captured groups in {{language}}.
Use only features supported by the stated flavor. Prefer the simplest pattern that satisfies all examples over a clever one.Requiring a test table, including negative cases, forces the model to check its own pattern. The flavor selector matters because lookbehind and Unicode support differ between engines.
Licensed CC0 (public domain) Version 1 · history
Generate a well-organized test suite covering happy paths, edge cases and failure modes for code you paste in.
Practice algorithm problems with progressive hints, complexity analysis and feedback, instead of getting spoiled with the answer.
Port code to another language so it reads like native code, with notes on behavior differences and gotchas.
Systematically narrow down why a test or bug only fails sometimes, with experiments to prove the cause.
Understand code you inherited: a layered explanation from the big picture down to the tricky lines.
Describe your messy data and get a prioritized cleaning plan with rules, code and a record of every change you make.
Comments (0)
Sign in to join the discussion.
No comments yet. Be the first to share how it worked.