
<alert comment="xpressive newbie"> vc7.1 xpressive from "vault" as of today (April 11) With the statements below (more or less based on Example 1 and Example 2 in the sample code provided with xpressive), I'm attempting to detect which "group" of subexpressions matched, and getting results that I don't understand (not unexpected for a newbie <g>). std::string altDow( "Alternate days of the week are Tue and Thursday and Sat and Monday." ); sregex rex = sregex::compile( "((Sunday|Sun)" "|(Monday|Mon)" "|(Tuesday|Tue)" "|(Wednesday|Wed)" "|(Thursday|Thu)" "|(Friday|Fri)" "|(Saturday|Sat))" ); The first regex_search sort of works, but I'm unclear what field in the smatch:what variable to use to tell what matched, and some oddities are happening. regex_search( altDow, what, rex ) Length(0): 3 Position(0): 31 what[0]: Tue what[1]: Tue what[2]: what[3]: what[4]: Tue The subsequent searches give valid information about the length and position, but other fields in the smatch:what variable seem invalid. regex_search( altDow.substr(32), what, rex) regex_search( altDow.substr(45), what, rex) Regardless, I'm unclear how to tell which of the "groups" of subexpressions was "hit". With boost::regex there was a way to loop thru the boolean field: what[i].matched and see what "hit", but I am not seeing a comparable accessor. Am I doing something wrong, leaving something out, completely clueless on using xpressive, or is xpressive not intended for this kind of usage? (and if xpressive is appropriate, what statements will provide the intended information?) The intention is to be able to to replace/encode the altDay string to be: Alternate days of the week are <dow=2>Tue</dow> and <dow=4>Thursday</dow> and <dow=6>Sat</dow> and <dow=1>Monday</dow>." ); If it will help, here is a link to the vc7.1 project. http://cleanspeech.sf.net/misc/DayOfWeekTest.zip </alert>