UtilForge

Regex Tester - Test Regular Expressions Online

Free online regex tester. Test JavaScript regular expressions, find matches and debug patterns instantly in your browser.

//g

What is Regex?

A regular expression (regex or regexp) is a sequence of characters that defines a search pattern. Regex is used for pattern matching within strings. Regular expressions are supported by virtually all programming languages and text editors.

How Regular Expressions Work

A regex engine processes a pattern character by character against a target string. Special characters called metacharacters have special meanings that define the matching rules. The engine tries to find matches from each position in the string.

Regex Examples

Email Address

[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}Contact us at support@utilforge.dev or info@example.com

URL

https?://[^\s/$.?#].[^\s]*Visit https://utilforge.dev or http://localhost:3000 for more

Password Strength

^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{8,}$Password123 weak Test1234

Common Regex Patterns

NamePattern
Digits only^\d+$
Letters only^[a-zA-Z]+$
Alphanumeric^[a-zA-Z0-9]+$
Hex Color^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$
Phone Number^\+?[1-9]\d{1,14}$
Date (YYYY-MM-DD)^\d{4}-\d{2}-\d{2}$
IPv4 Address\b(?:\d{1,3}\.){3}\d{1,3}\b
Username^[a-zA-Z0-9_.-]{3,20}$
Decimal Number^-?\d+(\.\d+)?$
UUID^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$

How to Use Regex Tester

  1. 1

    Enter your regular expression pattern in the top input field

  2. 2

    Paste or type the text you want to test in the bottom input area

  3. 3

    Click Test to see all matches with positions and captured groups

  4. 4

    Use flag toggles to enable global, case-insensitive, multiline, or dot-all matching

Frequently Asked Questions

What regex syntax does this tool support?

This tool supports JavaScript regular expression syntax, based on the ECMAScript standard. It supports all standard regex features including character classes, quantifiers, groups, lookaheads, and backreferences.

Is my data sent to a server when testing regex?

No. All regex testing happens entirely in your browser using JavaScript's built-in RegExp engine. Your patterns and test data never leave your device.

What do the regex flags g, i, m, and s do?

g (global) finds all matches. i (ignore case) makes the pattern case-insensitive. m (multiline) matches per-line boundaries. s (dotall) makes dot match newline characters.

Why does my regex work differently in JavaScript vs another language?

While most regex features are universal, each programming language has its own regex flavor with slightly different syntax. Check your target language's regex documentation for specific differences.

What are lookahead and lookbehind in regex?

Lookahead and lookbehind are zero-width assertions that check what comes after or before the current position without consuming characters. JavaScript supports lookahead (?=...) and negative lookahead (?!...). Lookbehind (?<=...) and (?<!...) work in modern browsers. Use them to match text only when it is — or is not — followed or preceded by another pattern.

How do I extract all email addresses or phone numbers from text?

Enable the global flag (g) and use a pattern such as \b[\w.+-]+@[\w-]+\.[\w.-]+\b for email addresses. With the g flag the engine returns every match in the test text instead of stopping at the first one. Ready-to-use patterns for emails, phone numbers, dates and IP addresses are listed in the Common Regex Patterns section above.

Found an issue with this tool?

Report a problem