I need regex which matches as per below values:
In short, it matches with only numeric string and any string with special character(#,&,%). Also it do not match with any other language string.
I tried this regex but it didn't work for me.
"^[\\d][#&%]+$"
答案 0 :(得分:0)
尝试类似
的内容"^\\d+|(.*[#&%].*)$"
答案 1 :(得分:0)
尝试以下正则表达式:
^((?=.*[#&%]).+|\d+)$
说明:
^ -> Start of the string
(?=.*[#&%]).+ -> Match at least one special character (#,&,%) from One or more character
| -> Or Condition
\d -> Match digit
$ -> End of the String