diff options
author | Xavier Leroy <xavier.leroy@inria.fr> | 2000-03-10 08:46:49 +0000 |
---|---|---|
committer | Xavier Leroy <xavier.leroy@inria.fr> | 2000-03-10 08:46:49 +0000 |
commit | 66f61f67a8f6d6f0e641da5805970ad95ba7220e (patch) | |
tree | 101e8b616ccc1b71c521155c7db0371df7a99b4e /otherlibs/str | |
parent | 6333985b45e8ee4e62d8e7687164cf9c350777d7 (diff) |
Doc de matched_group (exception Not_found)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@2935 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'otherlibs/str')
-rw-r--r-- | otherlibs/str/str.mli | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/otherlibs/str/str.mli b/otherlibs/str/str.mli index 5a1139fe4..146930adf 100644 --- a/otherlibs/str/str.mli +++ b/otherlibs/str/str.mli @@ -89,20 +89,28 @@ val match_end: unit -> int of the substring that was matched by [string_match], [search_forward] or [search_backward]. [match_end()] returns the position of the character following the last character of - the matched substring. *) + the matched substring. *) val matched_group: int -> string -> string (* [matched_group n s] returns the substring of [s] that was matched by the [n]th group [\(...\)] of the regular expression during the latest [string_match], [search_forward] or [search_backward]. The user must make sure that the parameter [s] is the same string - that was passed to the matching or searching function. *) + that was passed to the matching or searching function. + [matched_group n s] raises [Not_found] if the [n]th group + of the regular expression was not matched. This can happen + with groups inside alternatives [\|], options [?] + or repetitions [*]. For instance, the empty string will match + [\(a\)*], but [matched_group 1 ""] will raise [Not_found] + because the first group itself was not matched. *) val group_beginning: int -> int val group_end: int -> int (* [group_beginning n] returns the position of the first character of the substring that was matched by the [n]th group of the regular expression. [group_end n] returns the position of the character following the last character of - the matched substring. *) + the matched substring. Both functions raise [Not_found] + if the [n]th group of the regular expression + was not matched. *) (*** Replacement *) |