Regex URL Tester: Match a Pattern Against a URL List
Enter a regular expression and a list of URLs. See which URLs match, what the capture groups hold and what a replacement such as /articles/$2 would produce.
Use the tool
Why this tool exists
Redirect rules and analytics filters often use regular expressions, and a pattern that looks right can miss URLs or match too many. Testing against a real list of URLs catches that before the rule goes live.
This uses JavaScript regular expression syntax. Apache (PCRE), Nginx and Google Analytics have small differences, so re-check on the target system. A pattern with heavy backtracking can freeze the page: keep patterns simple.
How to use it
- Type the regex in the first box. A /pattern/flags form works too.
- Paste the URLs.
- Choose what to test against: path, path and query, or full URL.
- Optionally add a replacement to preview the redirect target.
Frequently asked questions
Which regex flavour is used?
JavaScript. Most simple patterns behave the same in PCRE, but lookbehind, possessive quantifiers and some escapes differ.
Should I test the path or the full URL?
Redirect rules in Apache and Nginx see the path only. Analytics filters usually see the page path or the full URL.
Why is a URL with a query string not matching?
With "path only" the query is ignored. Switch to "path and query" if your pattern includes it.
What does $1 mean in the replacement?
The first capture group, in the same way as in Apache RedirectMatch.