ppx_mikmatchversion Documentation on ocaml.org
Matching Regular Expressions with OCaml Patterns using Mikmatch's syntax
This syntax extension turns
match%mikmatch 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 (... as 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.
Additional extensions:
let%mikmatch name = {|re|}defines reusable patterns for use within(?U/N<name>)patternstype name = {%mikmatch| re |}generates record types with parse/pp functions from patterns- let destructuring via
let%pcre/mikmatch {| regex |} = s, whereregexbinds values andsis the input string /regex/flagsfor providing compiler flags.ifor caseless,a(%pcre) anchored,u(%mikmatch) unanchored- Caseless groups via the
~operator - Mixed matching (raw strings supported) via
function | {%mikmatch| ... |} -> ... | "raw string" -> ... - Matching guards are supported across all match extensions
| Authors | Petter A. Urkedal <paurkedal@gmail.com>, Gabriel Radanne <drupyog@zoho.com> and Leonardo Santos <leomendesantos@gmail.com> |
|---|---|
| License | LGPL-3.0-or-later WITH LGPL-3.0-linking-exception |
| Published | |
| Homepage | https://github.com/ahrefs/ppx_mikmatch |
| Issue Tracker | https://github.com/ahrefs/ppx_mikmatch/issues |
| Maintainer | Leonardo Santos <leomendesantos@gmail.com> |
| Dependencies | |
| Source [http] | https://github.com/ahrefs/ppx_mikmatch/archive/refs/tags/1.2.tar.gz md5=607d525df297c70ec7104d7188d2aa5b sha512=1f1da92620be9dbf1c7530c7d0bfc92bb736f4189ef97285b24b90bbb8ce24aaa0aa001c268a4029458def31dc972e813d163092caee5dc784f96380f9125618 |
| Edit | https://github.com/ocaml/opam-repository/tree/master/packages/ppx_mikmatch/ppx_mikmatch.1.2/opam |
No package is dependent


