===============十六进制判断=================================================
----------------------------------------前端正则方式-----------------------------------------------------------------------
var pattern=/\b0[xX][0-9a-fA-F]+\b/ ;//16进制验证
if(pattern.test($('#received_begin_value').val()) && pattern.test($('#received_end_value').val())){
}else{swal("接收报文起止值为16进制","","");return false;}
--------------------------------------后台转换方式验证-------------------------------------------------------------------
public
boolean
isTrueDigit(String str) {
try
{
Integer.parseInt(str,
16
);
}
catch
(NumberFormatException e) {
return
false
;
}
return
true
;
}
===================================数字正则===============================
"^\\d+$" //非负整数(正整数 + 0)
"^[0-9]*[1-9][0-9]*$" //正整数
"^((-\\d+)|(0+))$" //非正整数(负整数 + 0)
"^-[0-9]*[1-9][0-9]*$" //负整数
"^-?\\d+$" //整数
"^\\d+(\\.\\d+)?$" //非负浮点数(正浮点数 + 0)
"^(([0-9]+\\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\\.[0-9]+)|([0-9]*[1-9][0-9]*))$" //正浮点数
"^((-\\d+(\\.\\d+)?)|(0+(\\.0+)?))$" //非正浮点数(负浮点数 + 0)
"^(-(([0-9]+\\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\\.[0-9]+)|([0-9]*[1-9][0-9]*)))$" //负浮点数
"^(-?\\d+)(\\.\\d+)?$" //浮点数