Folgendes Beispiel
Code: Alles auswählen
#include <iostream>
#include <boost/regex.hpp>
using namespace std;
int main()
{
string stringOrig = "abc.äöü";
string charReplace = "*";
boost::regex pattern("\\w|[äöüÄÖÜß]");
string stringMod = boost::regex_replace(stringOrig, pattern, charReplace);
cout << "Original string: " << stringOrig << endl;
cout << "Modified string: " << stringMod << endl;
return 0;
}
Code: Alles auswählen
Original string: abc.äöü
Modified string: ***.******