Note: the groups argument is ignored in the following functions.
Once upon a time this argument determined how many groups were
copied to the result value.
Now all groups are accessible in the result value, no matter
what groups says.

Searches a match of the string with the regexp, starting at
the position and in forward direction.
Raises Not_found if no match could be found.
Returns (p,r) when a match at position p is found,
described by r.

Searches a match of the string with the regexp, starting at
the position and in backward direction.
Raises Not_found if no match could be found.
Returns (p,r) when a match at position p is found,
described by r.

Extracts the substring the nth group matches from the whole
string. The string argument
must be the same string passed to string_match or the search
functions, and the result argument must be the corresponding
result.

global_substitute re subst s: Applies the substitution function
subst to all matchings of re in s, and returns the
transformed string. subst is called with the current result
of the match and the whole string s.

substitute_first re subst s: Applies the substitution function
subst to the first matching of re in s, and returns the
transformed string. subst is called with the current result
of the match and the whole string s.