public class StringRegexExtension
extends java.lang.Object
String class.| Constructor and Description |
|---|
StringRegexExtension() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
matches(java.lang.String self,
java.lang.String regex)
Tells whether or not this string matches the given regular expression.
|
static java.lang.String |
replaceAll(java.lang.String self,
java.lang.String regex,
java.lang.String replacement)
Replaces each substring of this string that matches the given regular expression with the given replacement.
|
static java.lang.String |
replaceFirst(java.lang.String self,
java.lang.String regex,
java.lang.String replacement)
Replaces the first substring of this string that matches the given regular expression with the given replacement.
|
static java.lang.String[] |
split(java.lang.String self,
java.lang.String regex)
Splits this string around matches of the given regular expression.
|
public static java.lang.String replaceFirst(java.lang.String self,
java.lang.String regex,
java.lang.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 java.lang.String replaceAll(java.lang.String self,
java.lang.String regex,
java.lang.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 java.lang.String[] split(java.lang.String self,
java.lang.String regex)
self - the original string, corresponding to this, to be splitregex - the delimiting regular expressionPatternSyntaxException - if the regular expression's syntax is invalidpublic static boolean matches(java.lang.String self,
java.lang.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 invalid