Describe What You Want to Match and Let Claude Write the Regex
Nobody enjoys writing regex from scratch. Instead of staring at a cheat sheet, just tell Claude what you need to match and it writes the pattern for you — correctly, with an explanation, in the flavor your language uses.
> write a regex that matches UK phone numbers in any common format —
> with or without the country code, with spaces or dashes or no separators
Claude gives you the pattern, breaks down what each part does, and shows it matching against realistic examples so you can verify it handles the cases you care about.
This works for any complexity level:
> match email addresses but only from .edu domains
> extract the version number from strings like "v2.4.1" or "version 3.0"
> validate a password has at least 8 chars, one uppercase, one number,
> and one special character
> match markdown links and capture the text and URL separately
Where this really shines is when you already have sample data. Paste a few real examples and tell Claude what to extract:
> here are some log lines from our app:
> [2024-03-15 09:42:13] ERROR: Connection timeout after 30s (host=db-primary)
> [2024-03-15 09:42:14] WARN: Retry attempt 2/3 (host=db-primary)
> [2024-03-15 09:42:15] INFO: Connection restored (host=db-primary)
>
> write a regex that captures the timestamp, log level, message, and host
Claude writes the pattern, shows the named capture groups, and demonstrates it working against each line — so you can paste it into your code with confidence.
You can also ask Claude to explain an existing regex you inherited. Paste that unreadable 200-character monster from your codebase and Claude translates it back to English.
Never write regex by trial and error again — describe the pattern you need and Claude gets it right the first time.
via Claude Code
Log in to leave a comment.
Set up Claude Code as an automated reviewer in your CI pipeline — on every pull request, it reads the diff, checks for bugs, security issues, missing tests, and convention violations, then posts its findings as a PR comment. Your human reviewers get a head start because the obvious issues are already flagged before they look.
Before deploying, tell Claude to read your project — migrations, environment variables, queue workers, scheduled tasks, caching, third-party integrations — and generate a deployment checklist that's specific to your app. Not a generic "did you run migrations?" list, but one that knows YOUR infrastructure and catches the things YOUR deploy can break.
Instead of writing a README from memory or copying a template, tell Claude to read your project and generate one that's actually accurate — real setup instructions from your config, real architecture from your directory structure, real API examples from your routes, and real prerequisites from your dependency files.