Boost logo

Boost Users :

Subject: [Boost-users] Help needed in creating Regex...
From: Subhash Nagre (snagre.mumbai_at_[hidden])
Date: 2012-01-11 12:22:11


Hi everyone,
I need a help in creating a regular expression, I need to select only
"Sentences" in String using Regex so I wrote the Code ..

*boost::regex re( "(\\S.+?[.!?])(?=\\s+|$)" );*

This code considers that sentences break at any of these three characters
. ! ?
but this code considers string "Mr. Obama" as 2 difference sentences (being
a dot character in between), where as I want it to be only one sentence.

I have a got a string vector of all the words which have to excluded.

std::vector<std:string>exceptionVector;
exceptionVector.pushback("Mr.")
exceptionVector.pushback("Dr.")
exceptionVector.pushback("Mrs.")

Now in my regex, I want that if any of the words occur from my vector, it
should NOT be a seperate sentence.
Any idea how can I create this Regular expression

Thanks in Advance
-Subhash



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net