🌐
Home
🌐
About Us
🌐 Hosting
🌐
Hosting Checker
💰
Price Comparator
📦
Migration Checklist
💵
Cost Calculator

🔍 DNS & Network
🔍
DNS Lookup
🌍
DNS Propagation
📡
IP Lookup / WHOIS
🔌
Port Checker

🔒 Security
🔒
SSL Checker
🛡️
HTTP Header Checker
🔑
Password Generator
🤖
Robots.txt Generator

⚡ Performance
Speed Tester
⏱️
TTFB Tester
📡
Ping Tool
📊
Uptime Checker
📸
Screenshot Tool

</> Developer
{ }
JSON Formatter
64
Base64 Encoder
/./
Regex Tester
Cron Generator
📝
.htaccess Generator

☁️ Server & Cloud
🐘
PHP & MySQL Checker
☁️
AWS Cost Calculator

🌐
Blog
🌐
PDF Downloads

Regex
Tester

Test regular expressions in real-time. See matches highlighted, extract groups, replace and explore a full cheatsheet.

/ /
Test String
Presets:
Matches
Replace
Cheatsheet
Enter a pattern above to see matches

Regular Expression Tester

A regular expression (regex or regexp) is a sequence of characters defining a search pattern. Used in virtually every programming language, regex is essential for text processing, validation, parsing and transformation.



Regex flags explained

  • g (global) — Find all matches, not just the first
  • i (case insensitive) — Match regardless of case
  • m (multiline) — ^ and $ match start/end of each line
  • s (dotAll) — . matches newline characters too

Frequently Asked Questions

What does .* mean in regex? +
. matches any character (except newline by default), and * means "zero or more" of the preceding element. So .* matches any sequence of characters. It's greedy — it will match as much as possible. Use .*? for lazy matching (as little as possible).
How do I match a literal dot or special character? +
Escape it with a backslash. To match a literal dot use \., a literal + use \+, a literal ( use \(, etc. Special characters that need escaping: . * + ? ^ $ { } [ ] | ( ) \
What is a capture group and how do I use $1? +
Parentheses create a capture group: (pattern). Each group gets a number starting at 1. In replacement strings, $1 refers to the first group's match. For example, pattern (\w+) (\w+) with replacement $2 $1 would swap two words.
Is this JavaScript regex or PCRE? +
This tester uses JavaScript's built-in RegExp engine. JS regex is mostly compatible with other flavours but has some differences from PCRE (PHP/Python). Notably, JS supports lookbehind (?<=) in modern browsers, but doesn't support PCRE-specific features like \K or recursive patterns.
Developer Tools & Regex Guide

Check Regex Online: The Complete Guide to Testing & Debugging Regular Expressions

Learn how to test, validate, and optimize regular expressions online in real-time. Discover essential regex tokens, flags, production-ready snippets, and engine differences.

1. Why Check Regex Online?

Regular expressions (Regex) are concise search patterns used to parse text, validate forms, and extract structured data across programming languages. Because regex syntax is dense and prone to unexpected edge cases, writing patterns directly in code without testing can lead to subtle bugs or application performance issues.

Using an online regex checker provides an interactive environment to test patterns against sample strings with instant match highlighting, capture group inspection, and syntax feedback before pushing code to production.

Pro Tip: Most online regex checkers execute client-side using Web Assembly or native JavaScript engines, meaning your sensitive test data never leaves your browser.


2. Understanding Regex Flags

Flags (or modifiers) alter how the regex engine evaluates target text. When checking regex online, adjusting flags changes matching behavior dynamically:

Flag Name Effect
g Global Match Finds all matches across the input string rather than stopping after the first match.
i Ignore Case Makes matching case-insensitive (e.g., /abc/i matches ABC or Abc).
m Multiline Causes ^ and $ to match the start and end of each line instead of the whole string.
s Dot All Allows the wildcard dot (.) character to match newline characters (\n).
u Unicode Enables full Unicode matching, correctly handling multi-byte characters and emojis.

3. Essential Regex Tokens Cheat Sheet

Use this reference guide when constructing patterns inside an online regex tool:

Character Classes

  • \d : Any digit (0-9)
  • \D : Any non-digit
  • \w : Word character (a-z, A-Z, 0-9, _)
  • \s : Whitespace (space, tab, newline)
  • . : Any character except newline

Quantifiers

  • * : 0 or more occurrences
  • + : 1 or more occurrences
  • ? : 0 or 1 occurrence (optional)
  • {n,m} : Between n and m times

Anchors & Boundaries

  • ^ : Start of string / line
  • $ : End of string / line
  • \b : Word boundary edge

Groups & Ranges

  • [abc] : Match a, b, or c
  • [^abc] : Match anything except a, b, or c
  • (abc) : Capturing group
  • (?:abc) : Non-capturing group

4. Top Online Regex Checking Tools

Depending on your target programming language and debugging requirements, several online regex testers stand out:

Regex101

Offers a detailed breakdown of your expression step-by-step, unit testing capabilities, code export, and supports PCRE, JavaScript, Python, Go, Java, and .NET engines.

RegExr

Features an intuitive user interface with inline match tooltips, community pattern search, and an interactive cheatsheet for JavaScript and PCRE engines.

Playcode & Client-Side Testers

Ideal for quick web-focused tests using the browser's native JavaScript Engine for zero-latency execution.


5. Ready-to-Use Production Patterns

Below are commonly used regex patterns that you can paste directly into an online regex checker to validate against test data:

// Email Address Validation

^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$

// URL Pattern (HTTP/HTTPS)

^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)

// IPv4 Address

^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$

// Hex Color Code

^#(?:[0-9a-fA-F]{3}){1,2}$

6. Common Mistakes & Backtracking Hazards

When checking regex online, watch out for performance pitfalls and common logical errors:

1. Catastrophic Backtracking

Nested quantifiers like (a+)+ matched against non-matching text cause exponential runtime complexity, freezing browsers or servers (ReDoS - Regular Expression Denial of Service).

2. Unescaped Special Characters

Characters like ., ?, +, and ( have special meanings in regex. Escape them with a backslash (e.g., \.) when attempting to match literal characters.

3. Greedy vs. Lazy Quantifiers

Quantifiers like * and + are greedy by default—they grab as much text as possible. Append ? (e.g., *?) to make matching lazy.


7. Implementing Tested Regex in Code

Once you have validated your regex pattern online, copy and implement it into your codebase:

// JavaScript Example

const emailRegex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
const isValid = emailRegex.test("user@example.com"); // true

// PHP Example

$pattern = '/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/';
$isValid = preg_match($pattern, 'user@example.com');