Skip to content

Commit f4d6a69

Browse files
committed
update README for variable substitution feature
1 parent 03e1a86 commit f4d6a69

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,23 @@ function%pcre
2626
into suitable invocations of the [Re library][re], and similar for
2727
`match%pcre`. The patterns are plain strings of the form accepted by
2828
`Re_pcre`, with the following additions:
29-
29+
3030
- `(?<var>...)` defines a group and binds whatever it matches as `var`.
3131
The type of `var` will be `string` if the match is guaranteed given that
3232
the whole pattern matches, and `string option` if the variable is bound
3333
to or nested below an optionally matched group.
3434

35+
- `(N?<var>)` gets substituted by the value of the `%pcre` extended string variable named `var`,
36+
and binds whatever it matches as `var`.
37+
The type of `var` will be the same as `(?<var>...)`.
38+
39+
- `(N?<var as name>)` gets substituted by the value of the `%pcre` extended string variable named `var`,
40+
and binds whatever it matches as `name`.
41+
The type of `name` will be the same as `(?<var>...)`.
42+
43+
- `(U?<var>)` gets substituted by the value of the globally defined string variable named `var`,
44+
and does not bind its match to any name.
45+
3546
- `?<var>` at the start of a pattern binds group 0 as `var : string`.
3647
This may not be the full string if the pattern is unanchored.
3748

0 commit comments

Comments
 (0)