+/****f* silcutil/SilcRegexAPI/silc_regex
+ *
+ * SYNOPSIS
+ *
+ * SilcBool silc_regex(const char *string, const char *regex,
+ * SilcBuffer match, ...);
+ *
+ * DESCRIPTION
+ *
+ * Matches the `string' to the regular expression `regex'. Returns TRUE
+ * if the `string' matches the regular expression or FALSE if it does not
+ * match. The silc_errno is also set to SILC_ERR_NOT_FOUND.
+ *
+ * The first (whole) match is returned to `match' buffer if it is non-NULL.
+ * The variable argument list are buffers where multiple matches are
+ * returned in case of group (parenthesized) regular expression. The caller
+ * needs to know how many pointers to provide in order to get all matches.
+ * If a particular group is optional, a buffer pointer still must be given
+ * as argument for it, however, if it did not match the returned buffer
+ * length is 0 and data pointer is NULL.
+ *
+ * If `match' is non-NULL the variable argument list must be ended with
+ * NULL. The data in the `match' and in any other buffer is from `string'
+ * and must not be freed by the caller.
+ *
+ * EXAMPLE
+ *
+ * // Simple match
+ * if (!silc_regex("foobar", "foo.", NULL))
+ * no_match;
+ *
+ * // Get the pointer to the first match
+ * if (!silc_regex("foobar", ".bar", &match, NULL))
+ * no_match;
+ *
+ * // Group match
+ * SilcBufferStruct match, sub1, sub2;
+ *
+ * if (!silc_regex("Hello World", "(H..).(o..)", &match, &sub1, &sub2, NULL))
+ * no_match;
+ *
+ ***/
+SilcBool silc_regex(const char *string, const char *regex,
+ SilcBuffer match, ...);
+
+/****f* silcutil/SilcRegexAPI/silc_regex_buffer
+ *
+ * SYNOPSIS
+ *
+ * SilcBool silc_regex_buffer(SilcBuffer buffer, const char *regex,
+ * SilcBuffer match, ...);
+ *
+ * DESCRIPTION
+ *
+ * Same as silc_regex but the string to match is in `buffer'. Returns
+ * TRUE if the string matches and FALSE if it doesn't. See examples and
+ * other information in silc_regex. The `buffer' and `match' may be the
+ * same buffer.
+ *
+ ***/
+SilcBool silc_regex_buffer(SilcBuffer buffer, const char *regex,
+ SilcBuffer match, ...);
+
+/****f* silcutil/SilcRegexAPI/silc_subst
+ *
+ * SYNOPSIS
+ *
+ * SilcBool silc_subst(SilcBuffer buffer, const char *subst);
+ *
+ * DESCRIPTION
+ *
+ * Regular expression matching and substitution in `buffer' according
+ * to the substitution expression `subst'. This function provides
+ * Sed (Stream Editor) style substitution interface. The `subst' may
+ * be of following formats:
+ *
+ * 's/REGEXP/REPLACEMENT/FLAGS'
+ *
+ * Matches regular expression REGEXP in each line in the buffer and
+ * substitutes the match with REPLACEMENT.
+ *
+ * 'ADDRs/REGEXP/REPLACEMENT/FLAGS'
+ *
+ * Selects lines in the buffer matching the address ADDR and matches the
+ * regular expression REGEXP in the line and substitutes the match with
+ * REPLACEMENT.
+ *
+ * The ADDR may be of following format:
+ *
+ * /REGEXP/ Matches only lines matching the regular expression
+ * NUMBER Matches only the specified line number (1-n)
+ * $ Matches only the last line
+ *
+ * The FLAGS may be of following format:
+ *
+ * no FLAGS Finds first match in the line and replaces that
+ * g Finds and replaces all matches in the line
+ *
+ * An '!' may precede the 's'. In that case the ADDR is not matched.
+ *
+ * Returns TRUE if the match and replacement was done, FALSE in case
+ * of error, and sets the silc_errno.
+ *
+ * If you need to match and/or replace '/' characters, they must be
+ * escaped with '\' (C-style escaping for '\' is '\\').
+ *
+ * If you need more versatile ways to modify the buffer you may consider
+ * using the SILC_STR_REGEX in SILC Buffer Format API directly. This
+ * function only provides basic matching and substitution.
+ *
+ ***/
+SilcBool silc_subst(SilcBuffer buffer, const char *subst);
+
+/* Backwards support */
+#define silc_string_regex_match(regex, string) silc_regex(string, regex, NULL)
+