Bee Hive
Regex Tester
Test and debug regular expressions in real-time.
Common Patterns
Matches
About Regex Tester
Frequently Asked Questions
What is a Regular Expression (Regex)?
A Regular Expression is a sequence of characters that forms a search pattern. It is used for string matching, search-and-replace operations, and input validation.
What are the common regex flags?
The most common flags are: 'g' (global) to find all matches, 'i' (case-insensitive) to ignore case, and 'm' (multiline) for matching across multiple lines.
How do I match a literal period (.) in regex?
Because the period (.) is a metacharacter that matches any character, you must escape it with a backslash: \.
What is the difference between * and +?
The asterisk (*) matches zero or more occurrences of the preceding element, while the plus (+) matches one or more occurrences.
What are character classes?
Character classes like \d (digits), \w (word characters), and \s (whitespace) allow you to specify broad categories of characters to match.
How do I use 'OR' in regex?
You use the pipe character (|) to specify alternatives, such as 'cat|dog' which matches either word.
What are anchor characters?
The caret (^) matches the beginning of the string (or line), and the dollar sign ($) matches the end. They are used to ensure a pattern matches the entire input.
What is a 'greedy' vs 'lazy' match?
By default, quantifiers are 'greedy', matching as much text as possible. Adding a '?' (e.g., .+?) makes the match 'lazy', matching only what is absolutely necessary.
How do I create a non-capturing group?
You can create a non-capturing group by starting it with (?: ... ). This allows you to group elements for quantifiers without saving the match for later use.
Can I test lookahead and lookbehind assertions?
Yes! This tool supports modern JavaScript regex features, including positive and negative lookaheads (?= and ?!) and lookbehinds (?<= and ?<!).