Assert Regex Pattern Match

Verify that a regex pattern matches somewhere in the page HTML.

The Problem

When you need more than a simple substring — phone number formats, price patterns, structured IDs — a regex assertion lets you validate that the rendered HTML matches a specific pattern. Useful for catching malformed dynamic data in pSEO templates.

The Hard Way

Write a script that fetches each URL, compiles the regex, and tests it against the HTML. Handle compilation errors, timeouts, and reporting across thousands of pages.

The SEODiff Way

One API call. Results in under 2 seconds.

POST https://seodiff.io/api/v1/agent/evaluate

{"urls": ["https://example.com/product/widget-a"], "assertions": [{"rule": "regex_match", "value": "\\$\\d+\\.\\d{2}"}]}
ParameterTypeExample
valueregex\\$\\d+\\.\\d{2}

Code Examples

Copy-paste examples in your preferred language:

cURL

See the full evaluation example in cURL →

Python

See the full evaluation example in Python →

Node.js

See the full evaluation example in Node.js →

Go

See the full evaluation example in Go →

PHP

See the full evaluation example in PHP →

Related Assertions

regex_not_match

Ensure a regex pattern does NOT match in the page HTML.

contains_string

Verify that specific text appears in the rendered page.

Use in CI/CD

Add this assertion to your deployment pipeline. Works with any CI platform:

🐙 GitHub Actions

Block bad deployments with automated SEO checks in your GitHub Actions CI/CD pipeline.

🦊 GitLab CI

Add automated SEO quality gates to your GitLab CI/CD pipelines.

▲ Vercel

Automatically validate SEO on every Vercel preview deployment before promoting to production.

Start testing in 30 seconds

Get an API key and run your first evaluation with a single cURL command.

Get API Key or Read full API docs