程序包 com.ajaxjs.util

类 RegExpUtils

java.lang.Object
com.ajaxjs.util.RegExpUtils

public class RegExpUtils extends Object
正则表达式工具类
  • 构造器详细资料

    • RegExpUtils

      public RegExpUtils()
  • 方法详细资料

    • isMatch

      public static boolean isMatch(Pattern pattern, String str)
    • regMatch

      public static String regMatch(String regexp, String str, int groupIndex)
      使用正则的快捷方式。可指定分组
      参数:
      regexp - 正则
      str - 测试的字符串
      groupIndex - 分组 id,若为 -1 则取最后一个分组
      返回:
      匹配结果
    • regMatch

      public static String regMatch(String regexp, String str)
      使用正则的快捷方式
      参数:
      regexp - 正则
      str - 测试的字符串
      返回:
      匹配结果,只有匹配第一个
    • regMatchAll

      public static String[] regMatchAll(String regexp, String str)
      返回所有匹配项
      参数:
      regexp - 正则
      str - 测试的字符串
      返回:
      匹配结果
    • getPattern

      public static Pattern getPattern(String regexp)
    • match

      public static boolean match(String regexp, String str)
    • test

      public static boolean test(String pattern, String str)