MXS-2785: Report PCRE2 errors

The substitution string could cause errors.
This commit is contained in:
Markus Mäkelä
2019-12-09 14:19:15 +02:00
parent b32546e839
commit e36c7efa25
4 changed files with 39 additions and 7 deletions

View File

@ -28,10 +28,15 @@ namespace maxscale
* @param re Compiled pattern to use
* @param subject Subject string
* @param replace Replacement string
* @param error Pointer to std::string where any error messages are stored
*
* @return The replaced string or the original string if no replacement was made
* @return The replaced string or the original string if no replacement was made. Returns an empty string when
* any PCRE2 error is encountered.
*/
std::string pcre2_substitute(pcre2_code* re, const std::string& subject, const std::string& replace);
std::string pcre2_substitute(pcre2_code* re,
const std::string& subject,
const std::string& replace,
std::string* error = nullptr);
/**
* @class CloserTraits<pcre2_code*> pcre2.hh <maxscale/pcre2.hh>