sig
type t
type regex = t
type id_t = [ `Index of int | `Name of string ]
val index_of_id_exn : t -> id_t -> int
module Options : Options.S
val create :
?options:Options.t list -> string -> t Core_kernel.Std.Or_error.t
val create_exn : ?options:Options.t list -> string -> t
val of_string : string -> t
val to_string : t -> string
val num_submatches : t -> int
val pattern : t -> string
val find_all :
?sub:id_t -> t -> string -> string list Core_kernel.Std.Or_error.t
val find_all_exn : ?sub:id_t -> t -> string -> string list
val find_first :
?sub:id_t -> t -> string -> string Core_kernel.Std.Or_error.t
val find_first_exn : ?sub:id_t -> t -> string -> string
val find_submatches :
t -> string -> string option array Core_kernel.Std.Or_error.t
val find_submatches_exn : t -> string -> string option array
val matches : t -> string -> bool
val split : ?max:int -> ?include_matches:bool -> t -> string -> string list
val rewrite :
t -> template:string -> string -> string Core_kernel.Std.Or_error.t
val rewrite_exn : t -> template:string -> string -> string
val valid_rewrite_template : t -> template:string -> bool
val escape : string -> string
module Infix :
sig
val ( ~/ ) : string -> t
val ( =~ ) : string -> t -> bool
val ( //~ ) : string -> t -> string Core_kernel.Std.Or_error.t
val ( //~! ) : string -> t -> string
end
module Match :
sig
type 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 -> Sexplib.Sexp.t
end
val get_matches :
?sub:id_t ->
?max:int -> t -> string -> Match.t list Core_kernel.Std.Or_error.t
val get_matches_exn : ?sub:id_t -> ?max:int -> t -> string -> Match.t list
val replace :
?sub:id_t ->
?only:int ->
f:(Match.t -> string) -> t -> string -> string Core_kernel.Std.Or_error.t
val replace_exn :
?sub:id_t -> ?only:int -> f:(Match.t -> string) -> t -> 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 : Sexplib.Sexp.t -> t
val sexp_of_t : t -> Sexplib.Sexp.t
val compare : t -> t -> int
val bin_t : t Core_kernel.Std.Bin_prot.Type_class.t
val bin_read_t : t Core_kernel.Std.Bin_prot.Read.reader
val __bin_read_t__ : (int -> t) Core_kernel.Std.Bin_prot.Read.reader
val bin_reader_t : t Core_kernel.Std.Bin_prot.Type_class.reader
val bin_size_t : t Core_kernel.Std.Bin_prot.Size.sizer
val bin_write_t : t Core_kernel.Std.Bin_prot.Write.writer
val bin_writer_t : t Core_kernel.Std.Bin_prot.Type_class.writer
end