Advertisement
obernardovieira

[Boost] Regex (Test)

Mar 13th, 2014
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.54 KB | None | 0 0
  1. #include <boost/regex.hpp>
  2. #include <iostream>
  3. #include <string>
  4.  
  5. int main()
  6. {
  7.     std::string text("dgdr<p>55,99.5,99.6</p>svf<p>55,99.5,99.6</p>frdg");
  8.     const char* pattern = "<p>(.*?)</p>";//  [^,]+   -- seperar por virgulas
  9.     boost::regex ip_regex(pattern);
  10.  
  11.     boost::sregex_iterator it(text.begin(), text.end(), ip_regex);
  12.     boost::sregex_iterator end;
  13.     for (; it != end; ++it) {
  14.         std::cout << it->str() << "\n";
  15.         // v.push_back(it->str()); or something similar    
  16.     }
  17.     system("pause");
  18.     return 1;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement