Skip to content

Commit c1b28cd

Browse files
committed
update README for variable substitution feature
1 parent 9a37505 commit c1b28cd

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,19 @@ 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+
- `(?&var)` gets substituted by the value of the `%pcre` extended string variable named `var`. Doesn't bind.
36+
37+
- `(?&v:qname)` is a shortcut for `(?<v>(?&qname))`.
38+
39+
- `(U?<var>)` gets substituted by the value of the globally defined string variable named `var`,
40+
and does not bind its match to any name.
41+
3542
- `?<var>` at the start of a pattern binds group 0 as `var : string`.
3643
This may not be the full string if the pattern is unanchored.
3744

0 commit comments

Comments
 (0)