Online Regex Tester

A powerful, real-time regex tool for developers. Test patterns, see match results instantly, and use the built-in cheat sheet.

/ /

Match Results

No matches found.

RegEx Cheat Sheet

What is a Regular Expression (Regex)?

A regular expression is a sequence of characters that specifies a search pattern in text. Usually such patterns are used by string-searching algorithms for "find" or "find and replace" operations on strings, or for input validation. It is a technique developed in theoretical computer science and formal language theory.

Common Use Cases:

  • Input Validation: Ensuring user input like emails, phone numbers, and passwords are in the correct format.
  • Data Scraping: Extracting specific pieces of information (like prices or names) from web pages or documents.
  • Log Analysis: Searching for specific error codes or patterns in large log files.
  • Find and Replace: Performing powerful, pattern-based search and replace operations in text editors and IDEs.

Understanding Regex Flags

Flags, or modifiers, change how the regular expression is interpreted. This tool supports the most common JavaScript flags:

  • g (Global): Finds all matches in the string, not just the first one. Without this, the search stops after the first match.
  • i (Ignore Case): Makes the pattern case-insensitive (e.g., `/a/i` matches both "a" and "A").
  • m (Multiline): Allows the start (^) and end ($) anchors to match the start and end of individual lines within the string, not just the very start and end of the entire string.