Back to Tools

Regex Generator for SEO

Use cases

GSC query and page filters .htaccess redirect rules Screaming Frog extraction Log file analysis URL pattern matching

Claude Sonnet 4.5/4, Haiku 4.5 or GPT-4o/4o-mini with "regex expert specialising in SEO" system prompt.

Platform contexts: GSC, .htaccess, Screaming Frog, etc.

JSON output: pattern, explanation, flags, examples, platform notes.

Built-in tester with match metrics and visual indicators.

Streamlit App Requires API Key

Platform

Browser-based (no installation required)

Input

Anthropic or OpenAI API key

Plain English pattern description

Up to 4 test strings that should match

Output

Regex pattern, explanation, required flags, example matches/non-matches, platform notes.

Launch App View Source

Features

  • Platform-specific context (GSC/.htaccess/SF)
  • JSON output with explanation and examples
  • Ten preset SEO patterns (no API key needed)
  • Standalone pattern tester with match metrics
  • Up to 4 test strings when generating

How to use

  1. 1 Enter API key and select model
  2. 2 Select platform context (GSC, Apache, etc.)
  3. 3 Describe needed pattern in plain English
  4. 4 Add test strings for validation
  5. 5 Review pattern with syntax highlighting and test results

Frequently asked questions

Do I need an API key for every part of the tool?
No, only the Generate from Description tab calls an LLM. The Preset Patterns tab (ten ready-made SEO patterns like pagination, UTM parameters and trailing slashes) and the Test Regex tab both work entirely offline with no key. If you just want to test a pattern you already have, skip the key.
Why does a correct .htaccess pattern fail the built-in test?
The tester runs patterns through Python's re module, but the generator is told to produce Apache mod_rewrite syntax for .htaccess and RE2 syntax for Google Search Console. Platform-specific constructs can therefore fail or behave differently in the tester while still being correct on the target platform. Treat the test results as a sanity check and verify on the actual platform.
Which flags does the tester actually apply?
Only case-insensitivity: if the flags string contains an i, the pattern is compiled with re.IGNORECASE. Any other flags the model suggests are shown but ignored during testing. Matching uses re.search, so a pattern counts as a match if it matches anywhere in the string, not just the whole string.
How does the platform selection change the output?
The chosen context (General, Google Search Console, .htaccess, Screaming Frog, Google Analytics, Nginx, Log Files) is injected into the prompt with explicit rules: Apache mod_rewrite syntax for .htaccess, RE2 with no lookbehinds for GSC, standard regex for Screaming Frog. The response also includes a platform_notes field with caveats specific to your selection.
What does a generation cost?
One API call per click of Generate Regex, capped at 1024 output tokens on the Anthropic path, billed to your own key. Choosing claude-haiku-4-5 or gpt-4o-mini keeps each generation to a fraction of a cent; there is no batching or background usage.
How many test strings can I provide?
The generation tab accepts up to 4 test strings, which are sent to the model as examples that must match. The separate Test Regex tab has no such limit: paste as many strings as you like, one per line, and it reports a match count plus the exact matched text for each.

Need something built for your business?

This tool started as bespoke client work. I build custom scripts, data pipelines, and full apps for SEO and product data problems that off-the-shelf tools don't solve.

Tell Me What You Need