.TH RGXG_UTILS_ESCAPE_STRING 3 "Apr 12, 2020" "rgxg 0.1.2" "librgxg manual" .SH NAME rgxg_utils_escape_string \- escape the given string for use in a regular expression .SH SYNOPSIS .nf .B #include .BI "int rgxg_utils_escape_string (const char *" src ", size_t " size , .ti +5n .BI "char *" regex ", rgxg_options_t " options ); .fi .SH DESCRIPTION .BR rgxg_utils_escape_string () generates the (extended) regular expression that matches at most .I size bytes (or up to the first null byte) of the given string .IR src , by escaping the regular expression special characters. .I src must be valid and not NULL. The generated regular expression is written to the character string .IR regex , including the terminating null byte ('\\0'), unless .B RGXG_NONULLBYTE is set. If .I regex is NULL the return value is the number of characters (excluding the terminating null byte) that would have been written in case .I regex has been initialized. Note that the functions assume an arbitrarily long .I regex string, callers must .B ensure that the given string is large enough to not overflow the actual space. .I options is either zero, or set to the following macro: .TP .B RGXG_NONULLBYTE Do not add the terminating null byte ('\\0') to the .I regex string. .SH "RETURN VALUE" .BR rgxg_utils_escape_string () returns the number of characters (excluding the terminating null byte) written to .IR regex . .SH AVAILABILITY This function is available since rgxg 0.1. .SH SEE ALSO .BR regex (7), .BR rgxg_utils_alternation (3). .SH AUTHOR Hannes von Haugwitz