类 RegexUtil

java.lang.Object
tech.mhuang.pacebox.core.util.RegexUtil

public class RegexUtil extends Object
常用的正则表达式工具类
从以下版本开始:
1.0.13
作者:
yuanhang.huang
  • 字段详细资料

    • DOMAIN

      public static final String DOMAIN
      域名校验
      另请参阅:
    • EMAIL

      public static final String EMAIL
      Email正则表达式
      另请参阅:
    • PHONE

      public static final String PHONE
      电话号码正则表达式
      另请参阅:
    • MOBILE

      public static final String MOBILE
      手机号码正则表达式
      另请参阅:
    • INTEGER

      public static final String INTEGER
      Integer正则表达式
      另请参阅:
    • INTEGER_NEGATIVE

      public static final String INTEGER_NEGATIVE
      正整数正则表达式
      另请参阅:
    • INTEGER_POSITIVE

      public static final String INTEGER_POSITIVE
      负整数正则表达式
      另请参阅:
    • DOUBLE

      public static final String DOUBLE
      Double正则表达式
      另请参阅:
    • DOUBLE_NEGATIVE

      public static final String DOUBLE_NEGATIVE
      正Double正则表达式
      另请参阅:
    • DOUBLE_POSITIVE

      public static final String DOUBLE_POSITIVE
      负Double正则表达式
      另请参阅:
    • AGE

      public static final String AGE
      年龄正则表达式 匹配0-120岁
      另请参阅:
    • CODE

      public static final String CODE
      邮编正则表达式 国内6位邮编
      另请参阅:
    • STR_ENG_NUM_

      public static final String STR_ENG_NUM_
      匹配由数字、26个英文字母或者下划线组成的字符串
      另请参阅:
    • STR_ENG_NUM

      public static final String STR_ENG_NUM
      匹配由数字和26个英文字母组成的字符串
      另请参阅:
    • STR_ENG

      public static final String STR_ENG
      匹配由26个英文字母组成的字符串
      另请参阅:
    • STR_SPECIAL

      public static final String STR_SPECIAL
      过滤特殊字符串正则
      另请参阅:
    • DATE_ALL

      public static final String DATE_ALL
      日期正则 支持: YYYY-MM-DD YYYY/MM/DD YYYY_MM_DD YYYYMMDD YYYY.MM.DD的形式
      另请参阅:
    • DATE_FORMAT1

      public static final String DATE_FORMAT1
      日期正则 支持: YYYY-MM-DD
      另请参阅:
    • URL

      public static final String URL
      URL正则表达式 匹配 http www ftp
      另请参阅:
    • IDCARD

      public static final String IDCARD
      身份证正则表达式
      另请参阅:
    • JIGOU_CODE

      public static final String JIGOU_CODE
      机构代码
      另请参阅:
    • STR_NUM

      public static final String STR_NUM
      匹配数字组成的字符串 ^[0-9]+$
      另请参阅:
  • 构造器详细资料

    • RegexUtil

      public RegexUtil()
  • 方法详细资料

    • isIdCard

      public static boolean isIdCard(String str)
      判断字段是否为身份证 符合返回ture
      参数:
      str - 匹配的字符串
      返回:
      boolean
    • filterSpecialStr

      public static String filterSpecialStr(String str)
      过滤特殊字符串 返回过滤后的字符串
      参数:
      str - 匹配的字符串
      返回:
      boolean
    • isMatch

      public static boolean isMatch(String str, String pattern)
      匹配是否符合正则表达式pattern 匹配返回true
      参数:
      str - 匹配的字符串
      pattern - 匹配模式
      返回:
      boolean
    • matcher

      public static Matcher matcher(String str, String pattern)
      正则匹配器
      参数:
      str - 匹配的字符串
      pattern - 匹配模式
      返回:
      正则