| Constructor and Description |
|---|
StringRegexExtension() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
matches(String self,
String regex)
Tells whether or not this string matches the given regular expression.
|
static String |
replaceAll(String self,
String regex,
String replacement)
Replaces each substring of this string that matches the given regular expression with the given replacement.
|
static String |
replaceFirst(String self,
String regex,
String replacement)
Replaces the first substring of this string that matches the given regular expression with the given replacement.
|
static String[] |
split(String self,
String regex)
Splits this string around matches of the given regular expression.
|
public static boolean matches(String self, String regex)
self - the original string, corresponding to this, to check for matchingregex - the regular expression to which this string is to be matchedPatternSyntaxException - if the regular expression's syntax is invalidpublic static String replaceAll(String self, String regex, String replacement)
self - the original string, corresponding to this, to replace matches fromregex - the regular expression to which this string is to be matchedreplacement - the string to be substituted for each matchPatternSyntaxException - if the regular expression's syntax is invalidpublic static String replaceFirst(String self, String regex, String replacement)
self - the original string, corresponding to this, to replace the first match fromregex - the regular expression to which this string is to be matchedreplacement - the string to be substituted for the first matchPatternSyntaxException - if the regular expression's syntax is invalidpublic static String[] split(String self, String regex)
self - the original string, corresponding to this, to be splitregex - the delimiting regular expressionPatternSyntaxException - if the regular expression's syntax is invalid