java正则表达式校验

Pattern pattern = Pattern.compile("\\d+\\.\\d+$|-\\d+\\.\\d+$");//判断是否为小数
Pattern pattern1 = Pattern.compile("^\\d+$|-\\d+$");

if (pattern.matcher(monthValue).matches()||pattern1.matcher(monthValue).matches()) {
    BigDecimal yjh = new BigDecimal(monthValue);
    dayDetail = getDayPlanDetailvalue(dayDetail, yjh);
}

你可能感兴趣的:(java正则表达式校验)