I would like to match any one of these characters: <
or >
or <=
or >=
or =
.
This one doe
I'm not sure why you are using slashes (might have something with coldfusion that I'm not aware of, add them back if need be)... Your regex currently matches only one character. Try:
[<=>]{1,2}
If you want one regex to match only >
, <
, >=
, <=
and =
, there will be a bit more to that. The REMatch() function in coldfusion will return all the matched results in an array, so it's important to specify delimiters or boundaries in one way or another, because it's like a findall
in python, or preg_match_all
in PHP (or flagging the global match).
The boundary I think is the simplest is the \b
:
\b(?:[<>]=?|=)\b
Here's a demo with g activated.
And without these boundaries, here's what happens.
EDIT: Didn't realise something about the spaces. Could perhaps be fixed with this?
\b\s*(?:[<>]=?|=)\s*\b