Pattern
Test String
0 matchesResult of text.split(regex) — captured groups are included in the result, as in JavaScript.
Cheat Sheet — click to insert
| Any character (except newline, unless flag s) | |
| Digit [0-9] | |
| Non-digit | |
| Word character [A-Za-z0-9_] | |
| Non-word character | |
| Whitespace | |
| Non-whitespace | |
| Newline | |
| Tab | |
| A literal dot (escape special characters) |
| 0 or more (greedy) | |
| 1 or more (greedy) | |
| 0 or 1 (optional) | |
| Exactly 3 times | |
| 3 or more times | |
| Between 2 and 5 times | |
| 0 or more (lazy) | |
| 1 or more (lazy) |
| Capturing group | |
| Non-capturing group | |
| Named capturing group | |
| Backreference to group 1 | |
| Backreference to a named group | |
| Alternation (OR) |
| Start of string (of line with flag m) | |
| End of string (of line with flag m) | |
| Word boundary | |
| Non-word boundary |
| Positive lookahead | |
| Negative lookahead | |
| Positive lookbehind | |
| Negative lookbehind |
| a, b or c | |
| Anything except a, b, c | |
| Range a to z | |
| Any ASCII letter | |
| Any digit |
| Any letter, incl. ä, é, ß, 中 | |
| Uppercase letter | |
| Any number | |
| Characters of a script | |
| Emoji | |
| Code point (needs u/v) |
| Group 1 | |
| Named group | |
| The whole match | |
| Text before the match | |
| Text after the match | |
| A literal $ |
| Global — all matches | |
| Case-insensitive | |
| Multiline — ^ and $ per line | |
| Dot-all — . matches newlines | |
| Unicode — code points, \p{…} | |
| Unicode sets — [\p{L}--[a-z]], strings in classes | |
| Sticky — match at lastIndex only | |
| Indices — start/end of every group |