Regex Playground
JavaScript
Flags
0 characters
Enter a pattern and test text.
Matches and capture groups will appear here.
| Group | Value | Range |
|---|
An empty replacement removes matches. $& keeps the full match.
Output
Pattern
- .
- Any character except a line break; use s to include them.
- ^ $
- Start and end; use m for line boundaries.
- \d \w \s
- Digit, word character, whitespace.
- [abc] [^abc]
- Included or excluded characters.
- * + ?
- Zero or more, one or more, optional.
- {n,m}
- Between n and m repetitions.
- (…) (?:…)
- Capturing or non-capturing group.
- (?<name>…)
- Named capture group.
- (?=…) (?!…)
- Positive or negative lookahead.
- \p{L}
- Unicode letter; requires u or v.
Replacement
- $$
- A literal dollar sign.
- $&
- The entire match.
- $1 … $99
- A numbered capture group.
- $<name>
- A named capture group.
- $` $'
- The text before or after the match.
Ranges use UTF-16 offsets. The end position is exclusive. A narrow line in the test text marks an empty match.
g replaces every match; without g, only the first match is replaced. Sticky matching starts at position 0.
JavaScript regex reference ↗