How to match the comparative operator in the regular expression

I am trying to create a regular expression that matches comparisons like this:

= 445
> 5
>= 22
< 3
<= 42
<> 10

I think this will work, but it won’t:

[=|>|<|>=|<|<=|<>]\s\d+

‘>’very important or’<'in' ='Before. These operators are invalid:

=<
=>
>>
<<
==

I It is being used to create some dynamic sql, so the comparison operator requires valid sql.

Any suggestions?

I will say that the regular expression given by EmFi is good enough. With some modifications, it can take Such an expression

"currentDate>=2012/11/07&¤tDate<=2012/11/08";

or this

p>

"currentDate==2012/11/07";

With this modified regular expression

(<[=>]?|==|>=?|\&\&|\|\|)

and call it "effective". It may be simple, but at least In my case, it was enough

Edit: The regular expression was modified to make comparison operators (<,>,>=,<=,==) and Boolean operators (&&,|| ) Similar to C language

I am trying to create a regular expression that matches a comparison like this:

= 445
> 5
>= 22
< 3
<= 42
<> 10

I think this will work, But it will not:

[=|>|<|>=|<|<=|<>]\s\d+

'> 'Very important or'<' before'='. These operators are invalid:

=<
=>
>>
<<
= =

I am using it to create some dynamic sql, so the comparison operator requires valid sql.

Any suggestions?

I will say that the regular expression given by EmFi is good enough. With some modifications, it can take such an expression

< p>

"currentDate>=2012/11/07&¤tDate<=2012/11/08";

Or this

 "currentDate==2012/11/07";

With this modified regular expression

(<[=>]?|= =|>=?|\&\&|\|\|)

and call it "effective". It may be simple, but at least in my case, it is enough

Edit: The regular expression is modified to make the comparison operators (<,>,> =,< =,==) and Boolean operators (&&,||) similar to the C language

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 5408 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.