binaryWeapon
08-11-2008, 03:08 PM
I am in the midst of learning regex and have run into a simple (I hope) question that I cannot seem to find on the net. I have the regex:
[0-9A-Za-z_][=><][0-9A-Za-z_]
It checks for a word, a comparing sign (=, >, <, etc), and another word. I want to add the sign != to the comparing signs, but obviously putting two characters interprets them as 2 different ones. How can I do this? Also, is this the most efficient way to accomplish what I'm trying to do? This is my first experience actually using regular expressions in code so I don't want to get anything wrong :p. I need it to check the whole string, not just part of it (ie if there was a character, a comparing sign, and another character in the middle of the string, but other characters outside, like "*$*^$a>b*)&#$&^", it shouldn't work anymore).
[0-9A-Za-z_][=><][0-9A-Za-z_]
It checks for a word, a comparing sign (=, >, <, etc), and another word. I want to add the sign != to the comparing signs, but obviously putting two characters interprets them as 2 different ones. How can I do this? Also, is this the most efficient way to accomplish what I'm trying to do? This is my first experience actually using regular expressions in code so I don't want to get anything wrong :p. I need it to check the whole string, not just part of it (ie if there was a character, a comparing sign, and another character in the middle of the string, but other characters outside, like "*$*^$a>b*)&#$&^", it shouldn't work anymore).