Browse Source

优化数字匹配的正则

zhoutg 3 years atrás
parent
commit
ee2ee04746
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/main/java/com/diagbot/util/RegexUtil.java

+ 1 - 1
src/main/java/com/diagbot/util/RegexUtil.java

@@ -20,7 +20,7 @@ public class RegexUtil {
      * @return
      */
     public static boolean isNumbers(String str) {
-        String regex = "[0-9]+|([0-9]+\\.)+[0-9]*|[0-9]*(\\.[0-9]+)+";
+        String regex = "[0-9]+|([0-9]+\\.)[0-9]*|[0-9]*(\\.[0-9]+)";
         return str.matches(regex);
     }