Regex 需要百分比值正则表达式的帮助吗

Regex 需要百分比值正则表达式的帮助吗,regex,Regex,我试图将价值传递为95% numexu = 95% "^((>|GT|>=|GE|<|LT|<=|LE|==|EQ|!=|NE)?\\s*\\d?[%]?)$ if (!regex.IsMatch(numexu)) throw new ArgumentException("Percent expression is in an invalid format."); numexu=95% “^((>|GT|>=|GE|您只检查1个数字\\d?,请

我试图将价值传递为95%

numexu = 95%
"^((>|GT|>=|GE|<|LT|<=|LE|==|EQ|!=|NE)?\\s*\\d?[%]?)$
 if (!regex.IsMatch(numexu))
            throw new ArgumentException("Percent expression is in an invalid format.");
numexu=95%

“^((>|GT|>=|GE|您只检查1个数字
\\d?
,请尝试以下操作:
\\d{0,2}
,它接受0、1或2个数字。
使其匹配0或1倍


我不确定你是否需要转义
%
,如果需要,那么
\\\%
。此外,如果你只有一个字符,你可以跳过括号
[%]
,所以
%
(或者
\\\%
,如果需要转义)

^((>\\\\\\\>=| GE |请评估语言(python、perl、java?)并检查你的演示文稿(缩进)如果您告诉我们语言,并粘贴代码中有趣的部分,格式良好,这将非常有帮助。谢谢moon,但这一部分不起作用
   This Function will work for your requirement 

 function check() {
     var txtfield; txtfield =document.getElementById('txtbox').value; 
     var reg=/^(\d{0,2}%?$)/;
     if(reg.test(txtfield)){
     alert("match");

     }
     else { alert("Try again"); } 
      }