module Regexp: sig
.. end
executes a match
the result is an array of substrings corresponding to matched groups
0 is the whole substring matched by the regexp
1 is the outermost parenthetised group
etc.
type
t
type
flag =
| |
Global_search |
| |
Case_insensitive |
| |
Multi_line |
val make : string -> string -> t
val last_index : t -> int
val make : ?global:bool ->
?case_insensitive:bool -> ?multi_line:bool -> string -> t
val test : t -> string -> bool
val exec : t -> string -> string array
executes a match
the result is an array of substrings corresponding to matched groups
0 is the whole substring matched by the regexp
1 is the outermost parenthetised group
etc.
val index : t -> string -> int
returns the index of the first match of the regexp in the string
raises Not_found if the string is not matched by the regexp
val replace : t -> string -> string -> string
replace
regexp
substitution
string
special chars (doc from MDC):
- $$
Inserts a "$".
- $&
Inserts the matched substring.
- $`
Inserts the portion of the string that precedes the matched substring.
- $'
Inserts the portion of the string that follows the matched substring.
- $n or $nn Where n or nn are decimal digits
Inserts the nth parenthesized submatch string, provided the first argument was a RegExp object.
val replace_fun : t -> (int -> string array -> string) -> string -> string
replace_fun
regexp
substitution function
string
the substitution function takes :
- the offset of the current match
- an array of matched groups (0 = total curren match, see
exec
)
WARNING: uses callback mechanism which is not "au point"
val split : t -> string -> string array