I have a string:
string str1= "hello";
string str2="hel";
And I am doing this to see if str1 has str2 in it:
regex e = str2+"*"
bool x=regex_match(str1,e);
cout<<x;
I am getting this : error: conversion from 'std::__cxx11::basic_string' to non-scalar type 'std::__cxx11::regex {aka std::__cxx11::basic_regex}' requested regex e = str2+"";
How to use the variable in my regex. Can someone please tell me where am I going wrong? TIA.
str1,str2,helloandhel? How are they defined? Can you provide the complete code that produces the problem?hel*will matchhello, but not for the reason you probably think.hellohave quotes round it or is it another variable?