Matching operators (e.g. ==, >=) with regular expressions
I'm attempting to write a regex that will match the commonly used programming langauge operators. This is the regex string I'm using (it's part of a larger expression):
[>|<|>=|<=|==|!=]
This matches against ">", "<" but it doesn't match any of the others. I've tried escaping them like >=
or ==
but it doesn't make a difference.
I'm sure this is very simple and I'm missing something obvious.
[ ] - match one character
( ) - match group of characters
所以:
(>=|<=|>|<|==|!=)
链接地址: http://www.djcxy.com/p/76692.html