Regex Tester
Appliance Location: The Food Processor Real-Time MatchingHow to Test Regular Expressions Online
Testing and debugging regular expressions is straightforward with our regex tester. Follow these steps to validate your patterns:
- Enter Your Regex Pattern: Type or paste your regular expression into the pattern input field. You can include or omit the forward slashes.
- Select Flags: Choose from available flags — g (global search), i (case-insensitive), m (multiline), s (dotAll), u (unicode), y (sticky).
- Add Test String: Enter the text you want to search against. Use the sample text or load pre-built examples.
- View Results: See all matches highlighted in the preview, review match details with positions, and analyze capture groups.
Why Use a Regex Tester?
Regular expressions are powerful but notoriously difficult to write correctly. A single misplaced character can break your pattern or produce unexpected results. Our regex tester helps you debug complex patterns, validate input formats, learn regex syntax, and optimize performance with real-time visual feedback.
Understanding Regex Flags
- g (Global): Finds all matches rather than stopping after the first match. Essential for extracting multiple occurrences.
- i (Case-Insensitive): Makes the pattern match regardless of letter case. Example: /hello/i matches "HELLO", "Hello", and "hello".
- m (Multiline): Changes ^ and $ to match the start/end of each line instead of just the start/end of the entire string.
- s (DotAll): Allows the dot (.) to match newline characters as well. By default, dot matches any character except newline.
- u (Unicode): Enables full Unicode support, allowing patterns to match Unicode code points and characters from non-Latin scripts.
- y (Sticky): Matches only from the lastIndex position of the regex in the target string.
Complete Regex Syntax Reference
| Pattern | Description | Example |
|---|---|---|
. | Any character (except newline) | c.t matches "cat" |
\d | Any digit (0-9) | \d{3} matches "123" |
\w | Word character (a-z, A-Z, 0-9, _) | \w+ matches "hello123" |
\s | Whitespace | \s+ matches spaces and tabs |
^ | Start of string/line | ^Hello matches "Hello world" |
$ | End of string/line | world$ matches "Hello world" |
[abc] | Any character in set | [aeiou] matches vowels |
* | 0 or more times | a* matches "", "a", "aa" |
+ | 1 or more times | a+ matches "a", "aa", "aaa" |
| | OR operator | cat|dog matches "cat" or "dog" |
() | Capturing group | (\d{3})-(\d{3}) captures phone parts |
\b | Word boundary | \bcat\b matches "cat" as whole word |
Frequently Asked Questions
What is a regular expression (regex)?
A regular expression (regex) is a sequence of characters that defines a search pattern. Used for pattern matching, string validation, data extraction, and text manipulation. Supported in JavaScript, Python, Java, PHP, Ruby, and many text editors.
What do the regex flags mean?
Flags modify regex behavior: g (global) finds all matches, i (case-insensitive) ignores letter case, m (multiline) makes ^/$ match line boundaries, s (dotAll) allows . to match newlines, u (unicode) enables Unicode support, y (sticky) matches only from lastIndex position.
Is my regex pattern sent to a server?
No, absolutely not. Our regex tester processes everything locally in your browser. Your patterns and test strings never leave your device — perfect for testing patterns containing sensitive information.
Why is my regex not matching anything?
Common issues include: missing global flag (g) for multiple matches, incorrect escaping of special characters, case sensitivity (use i flag), whitespace differences (use \s), or greedy quantifiers matching too much.
What is the difference between greedy and lazy quantifiers?
Greedy quantifiers (*, +, {n,}) match as much as possible. Lazy quantifiers (*?, +?, {n,}?) match as little as possible. Example: <.+> on "
How do I test for whole words only?
Use word boundary anchors \b before and after your pattern. For example, /\bcat\b/ matches "cat" as a whole word but not "catalog" or "scat".
Is this tool free to use?
Yes, completely free with no usage limits, no registration, no watermarks, and no premium tiers. Test as many regex patterns as you need.