Smart Unit ConvertersSmart Unit Converters

Regex Tester

Test JavaScript regular expressions against sample text with live highlighting, named groups, and quick patterns.

//
Quick patterns…
18 matches found.
Convert 12 km to miles, 5 kg to pounds, and 100°F to Celsius. Email: hello@example.com
#1@0Convert
#2@812
#3@11km
#4@14to
#5@17miles
#6@245
#7@26kg
#8@29to
#9@32pounds
#10@40and
#11@44100
#12@48F
#13@50to
#14@53Celsius
#15@62Email
#16@69hello
#17@75example
#18@83com

?What is the Regex Tester?

The Regex Tester runs your regular expression against sample text and highlights every match in real time. Built on the JavaScript regex engine (the same one your browser, Node.js, and React/Vue apps use), so what works here works in your code. Toggle global, case-insensitive, multiline, dotall, and unicode flags with one click. Includes ready-made patterns for emails, URLs, IP addresses, dates, hex colors, phone numbers, and Pakistan CNIC. Capture groups are listed per match for inspection. Useful for log parsing, form validation, code refactoring, and learning regex.

The Formula

JavaScript RegExp follows ECMAScript 2018+ — supports lookbehind, named capture groups (?<name>…), Unicode property escapes \p{…}, and the s/dotAll flag.

Practical Examples

1

Email match: `[\w.+-]+@[\w-]+\.[\w.-]+` matches `hello@example.com` (use it for quick validation, not strict RFC 5322 compliance).

2

Pakistan CNIC: `\b\d{5}-\d{7}-\d\b` matches `12345-1234567-1`.

3

Extract URLs from text: `https?://[\w.-]+(?:/[\w./?%&=-]*)?` with the `g` flag.

4

Find all hex colors: `#[0-9a-fA-F]{3,8}\b` — useful in CSS / HTML files.

5

Validate IPv4: `\b(?:\d{1,3}\.){3}\d{1,3}\b` (note: doesn't enforce 0-255 ranges).

Frequently Asked Questions

Yes if you're writing JavaScript / TypeScript. Other languages have small differences — e.g., Python's `re` doesn't support lookbehind variability, .NET supports balanced groups, Perl has more features. Most basic patterns work everywhere.

Popular Conversions

Jump to a ready-made conversion — useful for quick reference and sharing: