Tiny utilities shared by the regex
library and its extensions. Useful for parsing and processing regular expressions, when you don't need a full regex AST builder.
Frozen object with the following properties for tracking regex syntax context:
DEFAULT
- Base context.CHAR_CLASS
- Character class context.
See documentation in the source code for more details.
Return a match object for the first unescaped version of a pattern in the given context, or null
.
Check whether an unescaped version of a pattern appears in the given context.
Run a callback on each unescaped version of a pattern in the given context.
Replaces the given pattern only when it's unescaped and in the given context.
Given a regex pattern and start position (just after the group's opening delimiter), return the contents of the group, accounting for escaped characters, nested groups, and character classes. Returns the rest of the string if the group is unclosed.