I am trying to replace * with whenever \w*\w pattern is found. Here is what I have
#include <string>
#include <iostream>
#include <regex>
using namespace std;
int main() {
string text = "Dear Customer, You have made a Debit Card purchase of INR962.00 on 26 Oct. Info.VPS*Brown House. Your Net Available Balance is INR 5,584.58.";
regex reg("[\w*\w]");
text = regex_replace(text, reg, " ");
cout << text << "\n";
}
But it replace the * with and w with also.
Output of the above program is
Dear Customer, You have made a Debit Card purchase of INR962.00 on 26 Oct. Info.VPS Bro n House. Your Net Available Balance is INR 5,584.58.
regex reg(R"((\w)\*(?=\w))");and replace with"$1 "[ ]does not mean what you think it means,[\w*\w]means replace any of the characterswor*.