Have a Snippet?

Keep, track and share your code snippets with your friends

C++: float RegExp Share on Vkontakte

takes a float number

#include 
#include 
#include 
 
#include 
 
int main() {
   std::string str = "-3.14asd.asd.a0.23.asdfj234d.123.34++23.0";
   boost::regex rgx("\\-?\\d+\\.\\d+");
   std::copy(
      boost::sregex_token_iterator(str.begin(), str.end(), rgx),
      boost::sregex_token_iterator(),
      std::ostream_iterator (std::cout, " ")
   );
   getchar();
}


Tag: C++, RegExp, Float

0 Comments