fork(52) download
  1. import java.util.regex.Pattern;
  2.  
  3. class Test
  4. {
  5. public static void main(String[] args)
  6. {
  7. final String regExp = "[0-9]+([,.][0-9]{1,2})?";
  8. final Pattern pattern = Pattern.compile(regExp);
  9. System.out.println("1.05".matches(regExp) + ", " + pattern.matches(regExp, "1.123"));
  10. }
  11. }
Success #stdin #stdout 0.07s 380160KB
stdin
Standard input is empty
stdout
true, false