0

i am trying to use regex_match to match specific string from regex string received from json file

the following will return false

regex_match ("pciereg044", regex(".*(pciereg041|pciereg047|pciereg044).*") )

where the following regex return true

regex_match ("pciereg044", regex(".*(pciereg041|pciereg044).*") )

it seems like the extra |string , are effecting my matching,what i am doing wrong ?

ibrahims
  • 1
  • 4
  • Your first example returns `true` for me. What compiler & version are you using? – Galik Oct 20 '20 at 16:15
  • c++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-16) – ibrahims Oct 20 '20 at 16:17
  • 1
    That is a very old version of the compiler. I *think* regex wasn't properly implemented before at least `GCC v4.9`. Can you upgrade the compiler? – Galik Oct 20 '20 at 16:20
  • Testing for this match is utterly trivial if you don’t use regular expressions. `std::string` can search for a matching substring and for a character match. – Pete Becker Oct 20 '20 at 17:00
  • i donot think it will work if i have string like pciereg044ah , after all i need regex its only example . – ibrahims Oct 20 '20 at 17:33

0 Answers0