Skip to content

Commit

Permalink
Add ppx_regexp.descr.
Browse files Browse the repository at this point in the history
  • Loading branch information
paurkedal committed Jun 4, 2017
1 parent 6ec4f62 commit 2f8c17e
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions ppx_regexp.descr
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Matching Regular Expressions with OCaml Patterns

This syntax extension turns

match%pcre x with
| {|re1|} -> e1
...
| {|reN|} -> eN
| _ -> e0

into suitable invocations to the ocaml-re library. The patterns are plain
strings of the form accepted by `Re_pcre`, except groups can be bound to
variables using the syntax `(?<var>...)`. The type of `var` will be
`string` if a match is of the groups is guaranteed given a match of the
whole pattern, and `string option` if the variable is bound to or nested
below an optionally matched group.

0 comments on commit 2f8c17e

Please sign in to comment.