Regex Tester Online Free — Pakistani Phone & CNIC Regex
Test regular expressions in real-time with live matching, character groups, and string replacement.
How It Works
Write Regex
Type in your regular expression pattern.
Insert String
Paste or write strings into the live test area.
View Output
Review highlighted matches and capture groups.
Frequently Asked Questions
What Regex engine does UtilVox use?
Are my test strings saved or monitored?
How does the live highlighting work?
Test Before You Trust
Patterns people test most
Live-testing against real sample text beats squinting at syntax. Starting points for the usual suspects:
| Target | Pattern sketch | Gotcha |
|---|---|---|
| Email (pragmatic) | ^[\w.+-]+@[\w-]+\.[\w.]+$ | A fully RFC-correct email regex is famously huge |
| Pakistani mobile | ^03\d{2}-?\d{7}$ | Accept both 0300-1234567 and 03001234567 |
| CNIC | ^\d{5}-\d{7}-\d$ | Decide upfront if dashes are required |
| Date (YYYY-MM-DD) | ^\d{4}-\d{2}-\d{2}$ | Matches 2026-99-99 too — validate ranges in code |
| Number in text | -?\d+(\.\d+)? | Anchors change everything — test with and without |
The two gotchas behind most broken regex
Greedy matching: .* grabs as much as it can — against <b>one</b><b>two</b>, the pattern <b>.*</b> matches the whole string, not the first tag. Add ? for lazy matching (.*?). Missing anchors: without ^ and $, a “validation” pattern happily matches a fragment inside garbage input — abc03001234567xyz passes a phone check that lacks anchors. Both bugs are invisible until tested against hostile sample text, which is the whole point of a tester.
Building a habit that scales
Keep a scratch file of nasty test cases per pattern: empty string, whitespace, mixed scripts, almost-valid inputs. Paste them all and confirm matches and non-matches before the pattern ships. Regex extracting from JSON usually means the JSON should have been parsed instead — check the JSON formatter. Cleaning URLs first helps patterns stay simple: the URL encoder/decoder normalizes percent-encoding before matching.