Regex Tester
Test regular expressions with match highlighting
Write a regex, paste your test string, and see matches highlighted inline — no script needed to check if your pattern actually works. Captured groups show up in a table below. Handy when building extractors for scraped HTML and you need to verify the pattern catches exactly what you expect.
How to use
- 1Write a pattern — Enter a regular expression in the Pattern field. No slashes — just the pattern.
- 2Select flags — g to find all matches, i for case-insensitive, m for multiline mode (^ and $ work per line).
- 3Paste test text — Copy an HTML fragment, page text, or API response.
- 4Inspect matches — In auto mode, matches highlight as you type. Disable auto mode to run manually with Run. Capture groups appear in a separate table below.
Examples
[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}\$?\d{1,3}(?:[,.]\d{3})*(?:[.,]\d{2})?href="(https?://[^"]+)"\b(\d{2})\.(\d{2})\.(\d{4})\b<span class="count">(\d+)</span>When to use for web scraping
Regular expressions in scraping are used at the post-processing stage: CSS selectors or XPath extract the right element, and regex extracts a specific value from its text. For example, an element contains "Price: $1,299" — regex extracts the number. Regex also works when HTML is poorly structured: no convenient classes or attributes, content is embedded in plain text. In Python — the re module, in JavaScript — native RegExp, in Scrapy — the re() method right after xpath() or css(). Test patterns here on real page fragments before embedding in code. One wrong character in a capture group and the parser will silently return empty strings instead of data.