Below is an example of a regex expression when using perl, but it does not match when using C ++. After reading the std :: regex class information at cplusplus.com, I may have to use regex_search. If I do not use flags in regex_match. Using regex_search seems to complicate the simple match I want to complete. I would like the match to be on line 1 similar to perl. Is there another line approach for doing regular matches in C ++?
C ++
std::string line1 = "interface GigabitEthernet0/0/0/3.50 l2transport";
if (std::regex_match(line1, std::regex("/^(?=.*\binterface\b)(?=.*\bl2transport\b)(?!.*\.100)(?!.*\.200)(?!.*\.300)(?!.*\.400).*$/")))
cout << line1;
Perl
my $line1 = "interface GigabitEthernet0/0/0/3.50 l2transport";
if ($line1 =~ /^(?=.*\binterface\b)(?=.*\bl2transport\b)(?!.*\.100)(?!.*\.200)(?!.*\.300)(?!.*\.400).*$/ )
print $line1;
I could create a method and pass the search criteria to return true or false ....
(Note: the reason I want to use C ++ is because it is much faster) is interpreted as compiled
( 2017-05-16: ++ , Perl . script , . Perl , ++ . . ++ , boost.)