regular expressions

Hello, I was wondering how i can use regular expressions in c++ to count every punctuation in one string. Can u help me? I searched but its always too hard to understand. If u can give mi example for this will be good. Some names of function searching punctuation or something.
Last edited on
what kind of library are you using?
Using Boost Regex? I don't really get what you're trying to do though, can you give an example (not using code, but like what would the string look like and what result do you want?)
For example this is the string: "This is some sentence with punctuation like: ? ,. ! - " . I want to get punctuation in an array using regular expressions. I use visual studio 2008 i don't know which library.
Regular expressions are overkill for something like that. Just loop through the string using std::ispunct() to collect the punctutation characters.: http://www.cplusplus.com/reference/clibrary/cctype/ispunct/
Topic archived. No new replies allowed.