What is a Regular Expression?
A regular expression (regex) is a sequence of characters that defines a search pattern. You can use regex to find, extract, or replace text that matches a specific structure — such as all email addresses in a document, all lines starting with a digit, or all words in CamelCase.
Regex Flags Explained
g— global: find all matches instead of stopping after the first.i— case insensitive: treat uppercase and lowercase as equal.m— multiline: make^and$match the start and end of each line.s— dot all: make.match newline characters as well.
Common Regex Patterns
| Pattern | Matches |
|---|---|
| \d+ | One or more digits |
| \w+ | One or more word characters (letters, digits, _) |
| \s+ | One or more whitespace characters |
| ^.+$ | Non-empty lines (with multiline flag) |
| [a-zA-Z]+ | One or more letters |
| \b\w{5}\b | Exactly 5-character words |
Frequently Asked Questions
Does this support lookaheads and lookbehinds?
Yes. This tester uses the JavaScript RegExp engine, which supports lookahead ((?=...), (?!...)) and lookbehind ((?<=...), (?<!...)) in modern browsers.
Why does my pattern fail?
Common causes: unescaped special characters (use \. to match a literal dot), mismatched parentheses, or using a flag combination the engine does not allow. The error message above the input shows the exact syntax error.
Is my data sent to a server?
No. All matching runs in your browser using the built-in JavaScript RegExp. No input is transmitted.