Hi everyone.
I am trying to create a regular expression that understands mathematical equations (>, <, =, <=, >=, !=)
. Which is something pretty simple. I have come up with:
/(.*)([!<>][=]|[<>=])(.*)/
But when I use this regex in PHP, with preg_match
, if equation is XYZ!=ABC
, it just matches with =
. Shouldn't it match the first expression it found from left to right, which is currently !=
? If mine solution is wrong -which seems so-, could anyone tell me why?
Thanks in advance.