I want to use this override of std::regex_search which can assgin offset (range) of the target string.
template< class BidirIt,
class CharT, class Traits >
bool regex_search( BidirIt first, BidirIt last,
const std::basic_regex<CharT,Traits>& e,
std::regex_constants::match_flag_type flags =
std::regex_constants::match_default );
Below is my code which doesn't compile. Getting rid of the m parameter would make it work, but I can retrieve the match information as that.
string s = "a**b cd e*f.";
size_t asteriskPos = s.find('*');
std::smatch m;
bool b = std::regex_search(s.begin()+asteriskPos , s.end(), m, std::regex("[^a-z*]"));
cout << b << endl;
Aucun commentaire:
Enregistrer un commentaire