regex - regex_search C++ not matching substrings -


this question has answer here:

regex_search not matching "ter" in "computer computer" when i'm using following code -

#include <iostream> #include <regex>  using namespace std;  int main() {     string str("computer computer");     cout << regex_search(str, regex("ter"));     return 0; } 

the above code gives me 0, whereas there "ter" in subject. going on here. know php's regex matches substring fine, whats wrong here?

i'm using c++11 gcc, problem since read somewhere has poor support regex.

it reruns 1 type bool, means pattern match found in word .run program.

#include <stdio.h> #include<iostream> #include <regex> using namespace std; int main(void) {     cout << regex_search(string("computer computer"), regex("ter"));//1     cout << regex_search(string("computer computer"), regex("tesdsr"));//0     return 0; } 

Comments

Popular posts from this blog

Load Balancing in Bluemix using custom domain and DNS SRV records -

oracle - pls-00402 alias required in select list of cursor to avoid duplicate column names -

python - Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] error -