FlexUtil
đź§Ş

Regex Tester & Debugger

Test and debug regular expressions in real-time with match highlighting and flag support.

Master Regular Expressions with our Regex Tester

Regular Expressions, or Regex, are a powerful language for pattern matching and text manipulation. Whether you are validating an email address, extracting data from logs, or performing complicated search-and-replace operations, a reliable Regex Tester is an essential tool in a developer’s kit.

How to use this tool

  1. Enter your Regex: Type your pattern in the top field. You don’t need to include the surrounding slashes.
  2. Set Flags: Use the flag selector to toggle global (g), case-insensitive (i), or multiline (m) modes.
  3. Test your string: Type or paste the text you want to search in the large text area. Matches will be highlighted in real-time.

Common Regex Patterns

If you’re just getting started, here are a few common patterns you can copy and paste:

  • Email Address: ^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$
  • Phone Number (US): ^(\+\d{1,2}\s)?\(?\d{3}\)?[\s.-]\d{3}[\s.-]\d{4}$
  • URL: 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]?)$

Understanding Regex Flags

Flags change how the engine interprets your pattern:

  • g (Global): Finds all matches rather than stopping after the first one.
  • i (Case-insensitive): Matches letters regardless of case (e.g., A matches a).
  • m (Multiline): Makes anchor characters (^ and $) match the start and end of individual lines, rather than the whole string.
  • u (Unicode): Enables full unicode support for matching special characters and emojis.

Why Test Regex?

Regular expressions can be notoriously difficult to read and debug. A small typo can lead to catastrophic performance issues (like “Catastrophic Backtracking”) or missed data. Testing your patterns against real-world sample text ensures your code behaves exactly as expected before you deploy it.