Regex Flags
Global, case-insensitive, multiline, dotall, unicode, sticky.
- regex flags
- case insensitive
- global flag
- dotall
- unicode flag
Regex Flags
Global, case-insensitive, multiline, dotall, unicode, sticky.
Commands
| Command | What it does |
|---|---|
/p/i | Case-insensitive |
/p/g | Global: all matches |
/p/m | Caret-dollar match per line |
/p/s | Dot matches newlines too |
/p/u | Full unicode semantics |
/p/y | Sticky: match at lastIndex |
Example
const re = /error.*/gis;
text.matchAll(re)
FAQ
When do I need the s flag?
When matching across lines - otherwise the dot stops at newlines.
What breaks without the u flag?
Emoji split into lone surrogates, and unicode property classes require u.
Частые вопросы
When do I need the s flag?
When matching across lines - otherwise the dot stops at newlines.
What breaks without the u flag?
Emoji split into lone surrogates, and unicode property classes require u.