functor (R : RegexpType) -> sig val scan : ?pat:string -> ?rex:R.regexp -> (string -> 'a -> 'a) -> 'a -> string -> 'a val sub : ?pat:string -> ?rex:R.regexp -> (int -> string -> string) -> string -> string end