SHARE
TWEET

Untitled

a guest Jan 21st, 2013 24 Never
  1. int _tmain(int argc, _TCHAR* argv[])
  2. {
  3.         string email1S = "abc 31432";
  4.         cmatch results;
  5.         regex mcn("([[:digit:]]+)");
  6.         string::const_iterator curPosition = email1S.begin();
  7.  
  8.         if (regex_search(curPosition, email1S.cend(), results, mcn))
  9.         {
  10.                 cout << "We have a match" << endl;
  11.                 cout << results[1].str() << endl;
  12.         }
  13.         curPosition += results[0].length();
  14.         cin.get();
  15.         return 0;
  16. }
RAW Paste Data
Top