package ppx_orakuda

  1. Overview
  2. Docs
type 'a t

The type of regexp. The parameter is to carry the pattern's type

val regexp : 'a t -> Re.re

Forget the pattern type and obtain the lower implementation by Re

val exec_exn : 'a t -> ?pos:int -> string -> 'a

Type enriched version of Re_pcre.exec. It may raise an exception

  • raises Not_found

    if pattern does not match.

val exec : 'a t -> ?pos:int -> string -> 'a option

Type enriched version of Re_pcre.exec. It may raise an exception

  • returns

    None if pattern does not match.

module Infix : sig ... end
val replace : 'a t -> templ:string -> ?pos:int -> string -> string

Type enriched version of Re_pcre.replace

val replace_first : 'a t -> templ:string -> ?pos:int -> string -> string

Type enriched version of Re_pcre.replace_first

val substitute_substrings : ('a -> string) -> 'a t -> ?pos:int -> string -> string

Same as Regexp.substitute_substrings but using Re_pcre

val substitute_substrings_first : ('a -> string) -> 'a t -> ?pos:int -> string -> string

Same as Regexp.substitute_substrings_first but using Re_pcre

val split : 'a t -> string -> string list

Same as Re_pcre.split

val build_case : 'a t -> ('a -> 'b) -> string -> 'b option

build_case t f s, if s matches with t, runs fun x -> Some (f x) over the result.

  • returns

    None if not match.

val build_cases : ?default:(unit -> 'a) -> (string -> 'a option) list -> string -> 'a

Composition of cases created by build_case

module Literal : sig ... end

You have to open Ppx_orakuda.Re_regexp.Literal to use {m|regexp|m} and {s|regexp|s} for Re_regexp.t

OCaml

Innovation. Community. Security.