TextSorter
/ /
Type a pattern above, then paste test text here

How to Use the Regex Tester

  1. Enter your pattern — type your regular expression between the / slashes
  2. Set flags — adjust the flags after the closing slash (default: g for global match)
  3. Paste test text — type or paste the string you want to test in the editor below
  4. See instant results — matches highlight in the preview; each match is listed with its index, length, and captured groups
  5. Replace mode — click Replace to test substitution patterns using back-references like $1, $2

Regex Flags Reference

Flag Name Description Example
g Global Find all matches instead of stopping at the first /cat/g matches every "cat"
i Case insensitive Match regardless of upper or lower case /hello/i matches "Hello", "HELLO"
m Multiline Makes ^ and $ match start/end of each line /^\d+/m matches digits at line starts
s DotAll Makes . match newline characters too /a.b/s matches "a\nb"
u Unicode Enables full Unicode matching /\u{1F600}/u matches emoji
y Sticky Matches only at the current lastIndex position Used for sequential parsing

Common Regex Patterns

Click Use to load any pattern directly into the tester:

Name Pattern Flags

Frequently Asked Questions

What is a regular expression (regex)?
A regular expression is a sequence of characters that defines a search pattern. It is used to find, match, validate, or replace text. Regex is supported in virtually every programming language and text editor, making it one of the most versatile text tools available.
How do I test a regular expression?
Enter your pattern in the field above and paste your test string in the editor. Results update automatically as you type — matches are highlighted in the preview and listed below with their character position, length, and any captured groups.
What regex flags should I use?
The most commonly used flags are g (global — find all matches), i (case insensitive), m (multiline — ^ and $ match line boundaries), and s (dotAll — dot also matches newlines). Combine freely, e.g. gi for global case-insensitive matching.
How do I make a case insensitive regex?
Add the i flag. With pattern hello and flags gi, the tester will match "hello", "Hello", "HELLO", and every other capitalization variant.

Related Tools

100% Private & Secure

All regex testing runs locally in your browser. Your patterns and test strings are never sent to any server — safe for passwords, tokens, proprietary code, or any sensitive content.