The following are methods for Pattern.
public static Pattern compile(String regExp)
Type: System.Pattern
public static Boolean matches(String regExp, String stringtoMatch)
Type: Boolean
If a pattern is to be used multiple times, compiling it once and reusing it is more efficient than invoking this method each time.
Note that the following code example:
Pattern.matches(regExp, input);
produces the same result as this code example:
Pattern.compile(regex). matcher(input).matches();
public String pattern()
Type: String
public static String quote(String yourString)
Type: String
Metacharacters (such as $ or ^) and escape sequences in the input string are treated as literal characters with no special meaning.
public String[] split(String regExp)
Type: String[]
The substrings are placed in the list in the order in which they occur in the String. If regExp does not match the pattern, the resulting list has just one element containing the original String.
public String[] split(String regExp, Integer limit)
Type: String[]