Ocaml module Re2
!!! Have to load manually before using.
in utop
#require "re2"
module M :
sig
module Re2 :
sig
type t = Re2.Regex.t
type regex = t
type id_t = [ `Index of int | `Name of string ]
val index_of_id_exn : regex -> id_t -> int
module Options :
sig
type t =
[ `Case_sensitive of bool
| `Dot_nl of bool
| `Encoding_latin1 of bool
| `Literal of bool
| `Log_errors of bool
| `Longest_match of bool
| `Max_mem of int
| `Never_capture of bool
| `Never_nl of bool
| `One_line of bool
| `Perl_classes of bool
| `Posix_syntax of bool
| `Word_boundary of bool ]
val latin1 : t list
val posix : t list
val noisy : t list
end
val create : ?options:Options.t list -> string -> regex Or_error.t
val create_exn : ?options:Options.t list -> string -> regex
val of_string : string -> regex
val to_string : regex -> string
val num_submatches : regex -> int
val pattern : regex -> string
val find_all : ?sub:id_t -> regex -> string -> string list Or_error.t
val find_all_exn : ?sub:id_t -> regex -> string -> string list
val find_first : ?sub:id_t -> regex -> string -> string Or_error.t
val find_first_exn : ?sub:id_t -> regex -> string -> string
val find_submatches : regex -> string -> string option array Or_error.t
val find_submatches_exn : regex -> string -> string option array
val matches : regex -> string -> bool
val split :
?max:int -> ?include_matches:bool -> regex -> string -> string list
val rewrite : regex -> template:string -> string -> string Or_error.t
val rewrite_exn : regex -> template:string -> string -> string
val valid_rewrite_template : regex -> template:string -> bool
val escape : string -> string
module Infix :
sig
val ( ~/ ) : string -> regex
val ( =~ ) : string -> regex -> bool
val ( //~ ) : string -> regex -> string Or_error.t
val ( //~! ) : string -> regex -> string
end
module Match :
sig
type t = Re2.Re2_internal.Match.t
val get : sub:id_t -> t -> string option
val get_exn : sub:id_t -> t -> string
val get_all : t -> string option array
val get_pos_exn : sub:id_t -> t -> int * int
val sexp_of_t : t -> Sexp.t
end
val get_matches :
?sub:id_t -> ?max:int -> regex -> string -> Match.t list Or_error.t
val get_matches_exn :
?sub:id_t -> ?max:int -> regex -> string -> Match.t list
val replace :
?sub:id_t ->
?only:int ->
f:(Match.t -> string) -> regex -> string -> string Or_error.t
val replace_exn :
?sub:id_t ->
?only:int -> f:(Match.t -> string) -> regex -> string -> string
module Exceptions :
sig
exception Regex_no_such_subpattern of int * int
exception Regex_no_such_named_subpattern of string * string
exception Regex_match_failed of string
exception Regex_submatch_did_not_capture of string * int
exception Regex_compile_failed of string
exception Regex_rewrite_template_invalid of string * string
end
val t_of_sexp : Sexp.t -> regex
val sexp_of_t : regex -> Sexp.t
val compare : regex -> regex -> int
val bin_t : regex Bin_prot.Type_class.t0
val bin_read_t : regex Bin_prot.Read.reader
val bin_reader_t : regex Bin_prot.Type_class.reader0
val bin_size_t : regex Bin_prot.Size.sizer
val bin_write_t : regex Bin_prot.Write.writer
val bin_writer_t : regex Bin_prot.Type_class.writer0
end
end