Class RegEx

java.lang.Object
uk.ac.ebi.utils.regex.RegEx

public class RegEx extends Object
An helper class for the regex library. Easier calls to the RE functions, plus caching of the pattern, which may speed up your code.
Author:
brandizi, copied from the library org.brandizi.jutils.
  • Constructor Details

  • Method Details

    • matcher

      public Matcher matcher(CharSequence input)
      Gets a new matcher for the input sequence
    • groups

      public String[] groups(CharSequence input)
      Returns all the groups in the input, see Java documentation for details
    • matches

      public boolean matches(CharSequence input)
    • getPattern

      public String getPattern()
    • matchesAny

      public static boolean matchesAny(String target, Pattern... patterns)
      Matches the string against any of the patterns, returns true at the first pattern that matches
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • of

      public static RegEx of(String pattern, int flags)
      This returns a RegEx that is cached, together with its compiled pattern. Caching is a very good idea when you need to reuse the same pattern many times, since compiling RE patterns is rather time-consuming.
    • of

      public static RegEx of(String pattern)