How to grab a string using boost::regex in C++? -


example string:

std::string sentence = "hello {bobby}, hows {johns}?." 

i want able grab inside curly braces using boost::regex, or guidance appreciated.

the string can contain {bobby|john|cindy} or {bobby||cindy} or {{bobby}} in it'll {bobby}. i'm trying figure out regex that.

thanks.

the overall approach , code example described here.

the regex need seems be:

([^{}]*\{([^{}]*)\})+ 

this regex not match @ unless string uses correctly paired, non-nested braces. if matches, can use regex_iterator process every second subgroups in each match.


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -