0

Hello, i have a problem constructing a regular expression to strip out puntuations from a document.Below is a simple example of my code

#
//headers here
//...

string a="kennedy .really-really. .cool";
string replace=" ";
string newStr;
boost::regex expression("[ ]+(\\.)|(\\.)[ ]+",boost::regex::icase);
newStr=boost::regex_replace(a,expression,replace);
cout << newStr << endl;

//output
kennedy really-really .cool

//Expected output
kennedy really-really cool

I dont intend to remove puntuations between two word like "really-really" , "re-instal". How do i go about this?

Thanks in advance

2
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by codedhands
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.