So I am trying to find out if string contains standalone 'c++'
substring, for example:
'abcabcabc c++ abc abc'
should return true
but
'abcabcabc c++11 abc abc'
should return false.
I am trying to achieve it using this regex: r'\bc\+\+\b'
which works fine for exactly same scenario for 'foo'
substring instead of 'c++'
(r'\bfoo\b'
, it returns true for 'abc abc foo abc abc'
and false for 'abc abc foo12 abc abc'
) but it does not work for 'c++'
. :(
What am I missing?
I am using python's re
module for that, regex101.com yields the same results.