With the answer from this question I was able to create a function that uses regex to find and replace in strings that works with both char and wchar_t
templ
std::regex_iterator is a class template too
template
std::size_t countMatches(const CharT* find, const CharT* str)
{
std::basic_string text(str);
std::basic_regex reg(find);
typedef typename std::basic_string::iterator iter_t;
return distance(std::regex_iterator(text.begin(), text.end(), reg),
std::regex_iterator());
}