[英]Validate LHS+OPERATOR+RHS regular expression in JavaScript?
I have only these operators : >
, >=
, <
, <=
, ==
, !=
, matches
我只有这些运算符:
>
、 >=
、 <
、 <=
、 ==
、 !=
、 matches
I have some values like below and expected Result我有一些像下面这样的值和预期的结果
<1.1> == 10 Match
<1.1> != 10 Match
<1.1> matches test Match
<1.1> matches test|user Match
<1.1> matches 10 Match
<1.1> matches 10|20 Match
<1.1> >= 10|20 Don't Match
<1.1> == 10|20 Don't Match
<1.1> != test Don't Match
<1.1> == test Don't Match
I tried this我试过这个
/^[a-zA-Z0-9_.<>]+[\s](<|<=|>|>=|==|!=|matches)[\s][a-zA-Z0-9_.<>|]+$/
but not working.但不工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.