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