= 32...">

RegEx helps operators

I need to map some operators: = ,! =,>, <, <=,> = The line I need to match may be something like this: "2 = 2 OR 33> = 32 AND 3 <5"

What can be a RegEx expression to match this, knowing that - I do not want to get a '=' match for the operator '<=' - Operators may or may not have spaces surrounding them.

Thanks in advance! Alex

+3
source share
5 answers

Try the following:

(<=|>=|!=|=|>|<)
+9
source

It works:

[<>!]?=|[<>]

: <, > ! = ( =),
: < > .

, , , (, )

+4

: [<>]=?|[!=]?=. = != > < <= >= ==.

+1

[^?!><=]+\s*(?<operator>[><!]?=|[><])\s*[^?!><=]+ + ExplicitCapture

>> === == ==

+1

? .,.

/[0-9]+[ ]*(<=|>=|!=|=|>|<)[ ]*[0-9]+/

... 0-9 , ​​ 0 , , 0 0-9 .

0

Source: https://habr.com/ru/post/1731003/


All Articles