|
@@ -10,25 +10,28 @@ public class RegularExpressionUtil {
|
|
//正、负浮点数
|
|
//正、负浮点数
|
|
String POSITIVE_NEGTIVE_FLOAT = "-?([1-9]\\d*.\\d*|0\\.\\d*[1-9]\\d*)";
|
|
String POSITIVE_NEGTIVE_FLOAT = "-?([1-9]\\d*.\\d*|0\\.\\d*[1-9]\\d*)";
|
|
//日期 yyyy MM dd
|
|
//日期 yyyy MM dd
|
|
- String DATE_TIME = "\\d{4}(\\-|\\/|.)\\d{1,2}\\1\\d{1,2}";
|
|
|
|
|
|
+ String DATE_TIME = "^\\d{4}-\\d{1,2}-\\d{1,2}";
|
|
|
|
|
|
public static String getRegularExpression(String filedType) {
|
|
public static String getRegularExpression(String filedType) {
|
|
RegularExpressionUtil obj = new RegularExpressionUtil();
|
|
RegularExpressionUtil obj = new RegularExpressionUtil();
|
|
switch (filedType) {
|
|
switch (filedType) {
|
|
case "bigint":
|
|
case "bigint":
|
|
- return obj.POSITIVE_NEGTIVE_INTEGER.replaceAll("\\\\\\\\", "\\\\");
|
|
|
|
|
|
+ return obj.POSITIVE_NEGTIVE_INTEGER;
|
|
|
|
+ //return obj.POSITIVE_NEGTIVE_INTEGER.replaceAll("\\\\\\\\", "\\\\");
|
|
case "decimal":
|
|
case "decimal":
|
|
- return obj.POSITIVE_NEGTIVE_FLOAT.replaceAll("\\\\\\\\", "\\\\");
|
|
|
|
|
|
+ return obj.POSITIVE_NEGTIVE_FLOAT;
|
|
|
|
+ //return obj.POSITIVE_NEGTIVE_FLOAT.replaceAll("\\\\\\\\", "\\\\");
|
|
case "datetime":
|
|
case "datetime":
|
|
- return obj.DATE_TIME.replaceAll("\\\\\\\\", "\\\\");
|
|
|
|
|
|
+ return obj.DATE_TIME;
|
|
|
|
+ //return obj.DATE_TIME.replaceAll("\\\\\\\\", "\\\\");
|
|
}
|
|
}
|
|
return "";
|
|
return "";
|
|
}
|
|
}
|
|
|
|
|
|
- /*public static void main(String[] args) {
|
|
|
|
- String str = "datetime";
|
|
|
|
- System.out.println(getRegularExpression(str));
|
|
|
|
- }*/
|
|
|
|
|
|
+ public static void main(String[] args) {
|
|
|
|
+ /*String str = "datetime";
|
|
|
|
+ System.out.println(getRegularExpression(str));*/
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|