ppx_orakuda

ORakuda, Perlish string literals in OCaml
Library ppx_orakuda
type 'a t

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

val regexp : 'a t -> Pcre.regexp

Forget the pattern type

val exec_exn : 'a t -> ?iflags:Pcre.irflag -> ?flags:Pcre.rflag list -> ?pos:int -> ?callout:Pcre.callout -> string -> 'a

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

  • raises Not_found

    if pattern does not match.

val exec : 'a t -> ?iflags:Pcre.irflag -> ?flags:Pcre.rflag list -> ?pos:int -> ?callout:Pcre.callout -> string -> 'a option

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

  • returns

    None if pattern does not match.

module Infix : sig ... end
val replace : 'a t -> templ:string -> ?iflags:Pcre.irflag -> ?flags:Pcre.rflag list -> ?pos:int -> ?callout:Pcre.callout -> string -> string

Type enriched version of Pcre.replace

val replace_first : 'a t -> templ:string -> ?iflags:Pcre.irflag -> ?flags:Pcre.rflag list -> ?pos:int -> ?callout:Pcre.callout -> string -> string

Type enriched version of Pcre.replace_first

val substitute_substrings : ( 'a -> string ) -> 'a t -> ?iflags:Pcre.irflag -> ?flags:Pcre.rflag list -> ?pos:int -> ?callout:Pcre.callout -> string -> string

Type enriched version of Pcre.substitute_substrings

val substitute_substrings_first : ( 'a -> string ) -> 'a t -> ?iflags:Pcre.irflag -> ?flags:Pcre.rflag list -> ?pos:int -> ?callout:Pcre.callout -> string -> string

Type enriched version of Pcre.substitute_substrings_first

val split : 'a t -> ?iflags:Pcre.irflag -> ?flags:Pcre.rflag list -> ?pos:int -> ?max:int -> ?callout:Pcre.callout -> string -> string list

Same as 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.Regexp.Literal to use {m|regexp|m} and {s|regexp|s} for Regexp.t