core: fix example in comment of function string_replace_regex
core: check that regex is not NULL in function string_replace_regex
tests: add tests of function string_replace_regex