I'm using this regex:
([\w\s]+)(=|!=)([\w\s]+)( (or|and) ([\w\s]+)(=|!=)([\w\s]+))*
to match a string such as this: i= 2 or i =3 and k!=4
When I try to extract values using m.group(index), I get:
(i, =, 2, **and k!=4**, and, k, ,!=, 4).
Expected output: (i, =, 2, or, i, =, 3, and, k , !=, 4) How do i extract the values correctly?
P.S. m.matches()
returns true.