Skip to content

Commit 2f8c17e

Browse files
committed
Add ppx_regexp.descr.
1 parent 6ec4f62 commit 2f8c17e

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

ppx_regexp.descr

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Matching Regular Expressions with OCaml Patterns
2+
3+
This syntax extension turns
4+
5+
match%pcre x with
6+
| {|re1|} -> e1
7+
...
8+
| {|reN|} -> eN
9+
| _ -> e0
10+
11+
into suitable invocations to the ocaml-re library. The patterns are plain
12+
strings of the form accepted by `Re_pcre`, except groups can be bound to
13+
variables using the syntax `(?<var>...)`. The type of `var` will be
14+
`string` if a match is of the groups is guaranteed given a match of the
15+
whole pattern, and `string option` if the variable is bound to or nested
16+
below an optionally matched group.

0 commit comments

Comments
 (0)