不好意思,顺序写错了:)
(\\d+\\.\\d{1,2})|\\d+

解决方案 »

  1.   

    public static boolean isCurrency(){
    String s="0.55";
    Pattern p = Pattern.compile("^\\d*(.\\d{2,2})?$",Pattern.CASE_INSENSITIVE);
    Matcher m = p.matcher(s);
    return m.matches();
        
       }
      

  2.   

    楼主----你站在了巨人( thomas_20(执子之手,与子偕老),dashu97(dashu))的肩膀上,所以你获得了成功(^[0-9]+$|^[0-9]+\.[0-9]{1,2}$),请原谅我的多嘴。