I'm using Javascript regex functions to split expressions like:
var1=32
var2<var4
var1!=var3
I'm using this regex:
/^(.*)([=|!=|<|>])(.*)$/ig
It works pretty well except with the != (different) operator. What's the problem?
The problem is you are using a character class instead of an alternation. The expression [=|!=|<|>] is equivalent to [<>=!|]. Remove the [ and ] to get what you want.
/^(.*?)(!=|=|<|>)(.*)$/ig
I've also changed the first (.*) to be non-greedy so that it doesn't consume the ! in !=. If you know that the left and right expressions will always contain (for example) only alphanumeric characters only, it would be better to specify that instead of matching with the dot.
[]denotes a character class, meaning this part of your expression is essentially the same as[=|!<>].