This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Jan 21st, 2013  |  syntax: C++  |  size: 0.38 KB  |  views: 23  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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. }
clone this paste RAW Paste Data