Replace matches of pattern() in subject with replacement.
Declared in <bdlpcre_regex.h>
int
replace(
bsl::string* result,
int* errorOffset,
std::string_view const& subject,
std::string_view const& replacement,
size_t options = 0) const;
Optionally specify a bit mask of options flags that configure the behavior of the replacement. options should contain a bit-wise OR of the k_REPLACE_* constants defined by this class. If options has k_REPLACE_GLOBAL then every matching substring is replaced; otherwise only the first match is replaced. UTF-8 validity checking is performed on subject and replacement if pattern() was prepared with k_FLAG_UTF8. Return the number of substitutions on success, and load result with the replacement text. On error, return a negative value. If that error is a syntax error in replacement, load errorOffset (if non-null) with the offset in replacement where the error was detected; for other errors load errorOffset with a negative value. The behavior is undefined unless true == isPrepared(). Note that if result is too small this method may resize it; prefer a buffer large enough for the result including a terminating null.