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