@Deprecated
public final class RegexUtil
extends java.lang.Object
For an example of intended use, see section Testing whether a string is a regular expression in the Checker Framework manual.
Modifier and Type | Class and Description |
---|---|
static class |
RegexUtil.CheckedPatternSyntaxException
Deprecated.
A checked version of
PatternSyntaxException . |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
asRegex(java.lang.String s)
Deprecated.
Returns the argument as a
@Regex String if it is a regex, otherwise throws an error. |
static java.lang.String |
asRegex(java.lang.String s,
int groups)
Deprecated.
Returns the argument as a
@Regex(groups) String if it is a regex with at least the
given number of groups, otherwise throws an error. |
static boolean |
isRegex(char c)
Deprecated.
Returns true if the argument is a syntactically valid regular expression.
|
static boolean |
isRegex(java.lang.String s)
Deprecated.
Returns true if the argument is a syntactically valid regular expression.
|
static boolean |
isRegex(java.lang.String s,
int groups)
Deprecated.
Returns true if the argument is a syntactically valid regular expression with at least the
given number of groups.
|
static java.lang.String |
regexError(java.lang.String s)
Deprecated.
Returns null if the argument is a syntactically valid regular expression.
|
static java.lang.String |
regexError(java.lang.String s,
int groups)
Deprecated.
Returns null if the argument is a syntactically valid regular expression with at least the
given number of groups.
|
static java.util.regex.PatternSyntaxException |
regexException(java.lang.String s)
Deprecated.
Returns null if the argument is a syntactically valid regular expression.
|
static java.util.regex.PatternSyntaxException |
regexException(java.lang.String s,
int groups)
Deprecated.
Returns null if the argument is a syntactically valid regular expression with at least the
given number of groups.
|
public static boolean isRegex(java.lang.String s)
s
- string to check for being a regular expressionpublic static boolean isRegex(java.lang.String s, int groups)
s
- string to check for being a regular expressiongroups
- number of groups expectedgroups
groupspublic static boolean isRegex(char c)
c
- char to check for being a regular expressionpublic static java.lang.String regexError(java.lang.String s)
s
- string to check for being a regular expressionpublic static java.lang.String regexError(java.lang.String s, int groups)
s
- string to check for being a regular expressiongroups
- number of groups expectedpublic static java.util.regex.PatternSyntaxException regexException(java.lang.String s)
s
- string to check for being a regular expressionpublic static java.util.regex.PatternSyntaxException regexException(java.lang.String s, int groups)
s
- string to check for being a regular expressiongroups
- number of groups expectedpublic static java.lang.String asRegex(java.lang.String s)
@Regex String
if it is a regex, otherwise throws an error.
The purpose of this method is to suppress Regex Checker warnings. It should be very rarely
needed.s
- string to check for being a regular expressionjava.lang.Error
- if argument is not a regexpublic static java.lang.String asRegex(java.lang.String s, int groups)
@Regex(groups) String
if it is a regex with at least the
given number of groups, otherwise throws an error. The purpose of this method is to suppress
Regex Checker warnings. It should be very rarely needed.s
- string to check for being a regular expressiongroups
- number of groups expectedjava.lang.Error
- if argument is not a regex