Regex Tool

Real-time pattern matching

Regular Expression Tool

Test, debug, and create your regex patterns with real-time matching, detailed results, and a comprehensive pattern library. Perfect for developers who work with regular expressions.

Pattern Library
Choose from common regex patterns. Use Pattern loads the regex, Try Example loads sample text.
Validation Mode: Patterns check if the entire string matches the format (perfect for form validation)

Email

Email & Communication

Validates if entire string is an email address

Example:
user@example.com

Email RFC 5322

Email & Communication

Comprehensive email validation (RFC 5322)

Example:
test.email+tag@example.co.uk

Phone US

Phone Numbers

Validates US phone number format

Example:
(555) 123-4567

Phone International

Phone Numbers

Validates international phone number (E.164)

Example:
+1234567890

URL HTTP/HTTPS

URLs & Web

Validates HTTP and HTTPS URLs

Example:
https://www.example.com/path?query=value

Domain Name

URLs & Web

Validates domain name format

Example:
example.com

IPv4 Address

URLs & Web

Validates IPv4 address format

Example:
192.168.1.1

Date YYYY-MM-DD

Dates & Time

Validates ISO date format

Example:
2023-12-25

Date MM/DD/YYYY

Dates & Time

Validates US date format

Example:
12/25/2023

Time 24-hour

Dates & Time

Validates 24-hour time format

Example:
14:30:00

Hex Color

Colors & Design

Validates hexadecimal color codes

Example:
#FF5733

RGB Color

Colors & Design

Validates RGB color format

Example:
rgb(255, 87, 51)

Credit Card

Numbers & Finance

Validates major credit card numbers

Example:
4532015112830366

Currency USD

Numbers & Finance

Validates US dollar amounts

Example:
$1,234.56

Social Security Number

Numbers & Finance

Validates US Social Security Number

Example:
123-45-6789

Currency EUR

Numbers & Finance

Validates Euro amounts

Example:
€1,234.56

Currency GBP

Numbers & Finance

Validates British Pound amounts

Example:
£1,234.56

IBAN

Numbers & Finance

Validates IBAN format (basic structure)

Example:
DE89370400440532013000

Percentage

Numbers & Finance

Validates a percentage value (0-100%)

Example:
45.5%

Scientific Notation

Numbers & Finance

Validates scientific notation numbers

Example:
6.022e23

Variable Name JS/Python

Programming & Code

Validates JavaScript/Python variable names

Example:
myVariable_123

JSON String

Programming & Code

Validates JSON string format

Example:
"Hello World"

JWT Token

Programming & Code

Validates JSON Web Token structure

Example:
eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxMjM0NTY3ODkwIn0.dozjgNryP4J3jVmNHl0w5N_XgL0n3I9PlFUP0THsR8U

Base64 String

Programming & Code

Validates Base64 encoded string format

Example:
SGVsbG8gV29ybGQh

Semantic Version

Programming & Code

Validates semantic versioning (semver) format

Example:
2.1.0-beta.1

Git Commit Hash

Programming & Code

Validates Git commit SHA (short or full)

Example:
a94a8fe5ccb19ba61c4c0873d391e987982fbbd3

NPM Package Name

Programming & Code

Validates npm package name format

Example:
@babel/core

Username

Text & Content

Validates username format (3-16 chars)

Example:
user_name123

Strong Password

Text & Content

Validates strong password requirements

Example:
MyPass123!

Slug

Text & Content

Validates URL-friendly slug format

Example:
my-blog-post-title

Markdown Link

Text & Content

Validates Markdown link syntax

Example:
[Wikipedia](https://wikipedia.org)

HTML Entity

Text & Content

Validates a single HTML entity

Example:
&

File Extension

File & Paths

Validates a filename has a valid extension

Example:
document.pdf

File Path Windows

File & Paths

Validates Windows file path format

Example:
C:\Users\Documents\file.txt

File Path Unix

File & Paths

Validates Unix/Linux file path format

Example:
/home/user/documents/file.txt

ZIP Code US

Geographic

Validates US ZIP codes

Example:
12345-6789

Postal Code Canada

Geographic

Validates Canadian postal codes

Example:
K1A 0A6

Lat/Long Coordinates

Geographic

Validates latitude,longitude coordinate pair

Example:
40.7128, -74.0060

Postal Code UK

Geographic

Validates UK postal code format

Example:
SW1A 1AA

MAC Address

Network & Security

Validates MAC addresses

Example:
00:1B:44:11:3A:B7

UUID

Network & Security

Validates UUID format

Example:
123e4567-e89b-12d3-a456-426614174000

IPv6 Address

Network & Security

Validates IPv6 address format

Example:
2001:0db8:85a3:0000:0000:8a2e:0370:7334

CIDR Notation

Network & Security

Validates IPv4 CIDR block notation

Example:
192.168.1.0/24

Port Number

Network & Security

Validates a network port number (0-65535)

Example:
8080

ISBN

Identifiers

Validates ISBN-10 or ISBN-13 (no hyphens)

Example:
9780306406157

VIN

Identifiers

Validates vehicle identification number (VIN)

Example:
1HGCM82633A123456

EAN/UPC Barcode

Identifiers

Validates EAN-13 or UPC-A barcode format

Example:
036000291452

HTTP Status Code

HTTP & APIs

Validates HTTP status code format

Example:
404

HTTP Method

HTTP & APIs

Validates HTTP request method

Example:
POST

YouTube Video ID

Social Media

Validates YouTube video ID format

Example:
dQw4w9WgXcQ

Twitter/X Handle

Social Media

Validates Twitter/X handle format

Example:
@nasa

Instagram Handle

Social Media

Validates Instagram handle format

Example:
@natgeo
Regex Cheat Sheet
Quick reference for regex patterns and syntax
Regular Expression
Enter your regex pattern and configure flags
Test String
Enter text to test against your regex pattern
Sample Texts:
Find & Replace
Replace matched patterns with new text
Use $1, $2, etc. for capture groups. Use $& for the entire match.
Export & Share
Save, load, or share your regex patterns
Import Text: Paste JSON data above, then click to import. Import File: Select a JSON file from your computer.
Results
Enter a pattern and test string to see results
Enter a regex pattern and test string to see matches

Comprehensive Regular Expression Testing and Debugging Tool

This regex testing tool provides a complete environment for creating, testing, and debugging regular expressions. Test patterns against sample text with real-time matching, view detailed match results with capture groups, and access a comprehensive library of pre-built patterns for common validation tasks including emails, phone numbers, URLs, dates, and more.

Key Features

  • Real-time Pattern Matching: See instant results as patterns are typed or test strings are modified
  • Pattern Library: Access 100+ pre-built regex patterns across 14 categories including email validation, phone numbers, URLs, dates, colors, credit cards, and more
  • Find & Replace: Test find-and-replace operations with regex patterns and see preview results before applying
  • Multiple Flags: Support for global, case-insensitive, multiline, dotAll, unicode, and sticky flags
  • Detailed Statistics: View match count, execution time, capture groups, and pattern complexity analysis
  • Export & Share: Generate code snippets in JavaScript, Python, PHP, Java, and other languages, or share patterns via URL
  • Cheat Sheet: Built-in reference guide for regex syntax, character classes, quantifiers, and special characters

Common Use Cases

Data Validation

Validate user input for emails, phone numbers, credit cards, passwords, and other formatted data

Text Extraction

Extract specific patterns from documents, logs, or web content such as URLs, dates, or identifiers

Search & Replace

Find and replace complex patterns in code, configuration files, or large text datasets

Code Analysis

Parse code to find variable names, function declarations, HTML tags, or JSON structures

Getting Started

  1. 1Choose a pattern from the library above or write a custom regular expression
  2. 2Enter test text in the input field or load a sample dataset
  3. 3View matches, capture groups, and statistics in real-time
  4. 4Adjust flags and refine the pattern as needed
  5. 5Export code or share the configuration with others