Could you explain why this regex doesn't work?
>>> d = "Batman,Superman"
>>> m = re.search("(?<!Bat)\w+",d)
>>> m.group(0)
'Batman'
Why doesn't group (0) match Superman? This tutorial says:
(? <! a) b matches "b", which is not which is preceded by "a", using a negative look back
+3
5 answers
, ( , , ). , , , , . , .
0 (.. B Batman) , Bat - , \w+ Batman (, - ).
, , - :
\b(?!Bat)\w+
(\b) 1 , , Bat. lookahead, lookbehind, lookbehind , ; , , , , lookbehind .
1 , \w \w (.. [A-Za-z0-9_] , ^ $ anchors). , .
+1