You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Tiny utilities shared by the [`regex`](https://github.com/slevithan/regex) library and its extensions. Useful for parsing and processing regular expressions, when you don't need a full regex AST builder.
7
+
Tiny utilities shared by the [regex](https://github.com/slevithan/regex) library and its plugins. Useful for parsing and processing regular expression syntax in a lightweight way, when you don't need a full regex AST.
8
8
9
9
## Constants
10
10
@@ -17,24 +17,53 @@ Frozen object with the following properties for tracking regex syntax context:
17
17
18
18
## Functions
19
19
20
-
See documentation in the source code for more details.
20
+
For all of the following functions, argument `expression` is the target string, and `needle` is the pattern to search for.
21
+
22
+
- Argument `expression` is assumed to be a flag-`v`-mode regex pattern string (in other words, nested character classes are allowed when determining the context for a match).
23
+
- Argument `needle` is a regex pattern as a string, and is applied with flags `su`.
24
+
- If argument `context` is not provided, matches are allowed in all contexts (in other words, inside and outside of character classes).
21
25
22
26
### `execUnescaped`
23
27
24
-
Returns a match object for the first unescaped instance of a pattern that is in the given context. Else, returns `null`.
Returns the contents of the group within the given pattern, with the group being identified by the position where its contents start (i.e., just *after* the group's opening delimiter). Accounts for escaped characters, nested groups, and character classes. Returns the rest of the string if the group is unclosed.
67
+
Arguments: `expression, contentsStartPos`
68
+
69
+
Extracts the full contents of a group (subpattern) from the given expression, accounting for escaped characters, nested groups, and character classes. The group is identified by the position where its contents start (the string index just after the group's opening delimiter). Returns the rest of the string if the group is unclosed.
0 commit comments