#include <iostream>
#include <string>
#include <regex>
using namespace std;
int main () {
regex rxWorld("world");
const string text = "hello world!";
const auto t0 = text.cbegin();
smatch match;
const bool ok = regex_search(text, match, rxWorld);
cout << " text:'" << text
<< "' ok:" << ok
<< " size:" << match.size()
<< " pos:" << match.position()
<< " len:"<< match.length()
<< endl;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3RyaW5nPgojaW5jbHVkZSA8cmVnZXg+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4gKCkgewogICAgcmVnZXggcnhXb3JsZCgid29ybGQiKTsKICAgIGNvbnN0IHN0cmluZyB0ZXh0ID0gImhlbGxvIHdvcmxkISI7CiAgICBjb25zdCBhdXRvIHQwID0gdGV4dC5jYmVnaW4oKTsKICAgIHNtYXRjaCBtYXRjaDsKICAgIGNvbnN0IGJvb2wgb2sgPSByZWdleF9zZWFyY2godGV4dCwgbWF0Y2gsIHJ4V29ybGQpOwogICAgY291dCA8PCAiICB0ZXh0OiciIDw8IHRleHQKICAgICAgICAgPDwgIicgb2s6IiA8PCBvawogICAgICAgICA8PCAiIHNpemU6IiA8PCBtYXRjaC5zaXplKCkKICAgICAgICAgPDwgIiBwb3M6IiA8PCBtYXRjaC5wb3NpdGlvbigpCiAgICAgICAgIDw8ICIgbGVuOiI8PCBtYXRjaC5sZW5ndGgoKQogICAgICAgICA8PCBlbmRsOwp9Cg==
/usr/lib/gcc/i686-pc-linux-gnu/4.5.1/../../../../include/c++/4.5.1/tr1_impl/regex:2257:5: warning: inline function 'bool std::regex_search(_Bi_iter, _Bi_iter, std::match_results<_Bi_iter, _Allocator>&, const std::basic_regex<_Ch_type, _Rx_traits>&, std::regex_constants::match_flag_type) [with _Bi_iter = __gnu_cxx::__normal_iterator<const char*, std::basic_string<char> >, _Allocator = std::allocator<std::sub_match<__gnu_cxx::__normal_iterator<const char*, std::basic_string<char> > > >, _Ch_type = char, _Rx_traits = std::regex_traits<char>, std::regex_constants::match_flag_type = std::bitset<11u>]' used but never defined
/home/V1FoTz/ccHkj6Nu.o: In function `main':
prog.cpp:(.text+0x4f): undefined reference to `std::basic_regex<char, std::regex_traits<char> >::_M_compile()'
prog.cpp:(.text+0xd7): undefined reference to `bool std::regex_search<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::sub_match<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, char, std::regex_traits<char> >(__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, __gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::match_results<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::sub_match<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > >&, std::basic_regex<char, std::regex_traits<char> > const&, std::bitset<11u>)'
collect2: ld returned 1 exit status