module Re:sig..end
Module Re: regular expressions commons
type t
Regular expression
type re
Compiled regular expression
type groups
Information about groups in a match.
val compile : t -> reCompile a regular expression into an executable version that can be
used to match strings, e.g. with Re.exec.
val exec : ?pos:int -> ?len:int -> re -> string -> groupsexec re str matches str against the compiled expression re,
and returns the matched groups if any.
Not_found if the regular expression can't be found in strpos : optional beginning of the string (default 0)len : length of the substring of str that can be matched (default -1,
meaning to the end of the stringval exec_opt : ?pos:int -> ?len:int -> re -> string -> groups optionSimilar to Re.exec, but returns an option instead of using an exception.
val execp : ?pos:int -> ?len:int -> re -> string -> boolSimilar to Re.exec, but returns true if the expression matches,
and false if it doesn't
val exec_partial : ?pos:int -> ?len:int -> re -> string -> [ `Full | `Mismatch | `Partial ]More detailed version of exec_p
module Group:sig..end
Manipulate matching groups.
module Mark:sig..end
Marks
type'agen =unit -> 'a option
val all : ?pos:int -> ?len:int -> re -> string -> Group.t listRepeatedly calls Re.exec on the given string, starting at given
position and length.
val all_gen : ?pos:int -> ?len:int -> re -> string -> Group.t genSame as Re.all but returns a generator
val matches : ?pos:int -> ?len:int -> re -> string -> string listSame as Re.all, but extracts the matched substring rather than
returning the whole group. This basically iterates over matched
strings
val matches_gen : ?pos:int -> ?len:int -> re -> string -> string genSame as Re.matches, but returns a generator.
val split : ?pos:int -> ?len:int -> re -> string -> string listsplit re s splits s into chunks separated by re. It yields
the chunks themselves, not the separator. For instance
this can be used with a whitespace-matching re such as "[\t ]+".
val split_gen : ?pos:int -> ?len:int -> re -> string -> string gen
typesplit_token =[ `Delim of Group.t | `Text of string ]
val split_full : ?pos:int -> ?len:int -> re -> string -> split_token list
val split_full_gen : ?pos:int -> ?len:int -> re -> string -> split_token gen
val replace : ?pos:int ->
?len:int ->
?all:bool -> re -> f:(Group.t -> string) -> string -> stringreplace ~all re ~f s iterates on s, and replaces every occurrence
of re with f substring where substring is the current match.
If all = false, then only the first occurrence of re is replaced.
val replace_string : ?pos:int -> ?len:int -> ?all:bool -> re -> by:string -> string -> stringreplace_string ~all re ~by s iterates on s, and replaces every
occurrence of re with by. If all = false, then only the first
occurrence of re is replaced.
val str : string -> t
val char : char -> tval alt : t list -> tAlternative
val seq : t list -> tSequence
val empty : tMatch nothing
val epsilon : tEmpty word
val rep : t -> t0 or more matches
val rep1 : t -> t1 or more matches
val repn : t -> int -> int option -> trepn re i j matches re at least i times
and at most j times, bounds included.
j = None means no upper bound.
val opt : t -> t0 or 1 matches
val bol : tBeginning of line
val eol : tEnd of line
val bow : tBeginning of word
val eow : tEnd of word
val bos : tBeginning of string
val eos : tEnd of string
val leol : tLast end of line or end of string
val start : tInitial position
val stop : tFinal position
val word : t -> tWord
val not_boundary : tNot at a word boundary
val whole_string : t -> tOnly matches the whole string
val longest : t -> tLongest match
val shortest : t -> tShortest match
val first : t -> tFirst match
val greedy : t -> tGreedy
val non_greedy : t -> tNon-greedy
val group : t -> tDelimit a group
val no_group : t -> tRemove all groups
val nest : t -> twhen matching against nest e, only the group matching in the
last match of e will be considered as matching
val mark : t -> Mark.t * tMark a regexp. the markid can then be used to know if this regexp was used.
val set : string -> tAny character of the string
val rg : char -> char -> tCharacter ranges
val inter : t list -> tIntersection of character sets
val diff : t -> t -> tDifference of character sets
val compl : t list -> tComplement of union
val any : tAny character
val notnl : tAny character but a newline
val alnum : t
val wordc : t
val alpha : t
val ascii : t
val blank : t
val cntrl : t
val digit : t
val graph : t
val lower : t
val print : t
val punct : t
val space : t
val upper : t
val xdigit : tval case : t -> tCase sensitive matching
val no_case : t -> tCase insensitive matching
val pp : Format.formatter -> t -> unit
val pp_re : Format.formatter -> re -> unit
val print_re : Format.formatter -> re -> unitAlias for Re.pp_re. Deprecated
.
val witness : t -> stringwitness r generates a string s such that execp (compile r) s is
true
typesubstrings =Group.t
Alias for Re.Group.t. Deprecated
val get : Group.t -> int -> stringSame as Re.Group.get. Deprecated
val get_ofs : Group.t -> int -> int * intSame as Re.Group.offset. Deprecated
val get_all : Group.t -> string arraySame as Re.Group.all. Deprecated
val get_all_ofs : Group.t -> (int * int) arraySame as Re.Group.all_offset. Deprecated
val test : Group.t -> int -> boolSame as Re.Group.test. Deprecated
typemarkid =Mark.t
Alias for Re.Mark.t. Deprecated
val marked : Group.t -> Mark.t -> boolSame as Re.Mark.test. Deprecated
val mark_set : Group.t -> Mark.Set.tSame as Re.Mark.all. Deprecated