Utility class for managing and validating text against precompiled regular expressions. More...
Public Member Functions | |
| String | getSpecialChars () |
| Returns the allowed special characters for password validation. | |
| boolean | isValidAlphanumeric (final String text) |
| boolean | isValidPlayerName (final String playerName) |
| boolean | isValidSecret (final char[] secret) |
| Validates the given password character array against strict security rules. | |
| boolean | isValidVersion (final String version) |
| boolean | isValidZeroCommaGrid (final String gridText) |
Public Attributes | |
| INSTANCE | |
Private Member Functions | |
| boolean | isValidatedByRegex (final String text, final Pattern pattern, boolean textMustNotBeNullOrBlank) |
| Validates the given string against the specified regex pattern. | |
| boolean | isValidPassword (final CharBuffer buffer) |
| Validates a password character buffer against strict security rules: | |
Static Private Attributes | |
| static final Pattern | ALPHANUMERIC_PATTERN = Pattern.compile("^[a-zA-Z0-9\\s.]+$") |
| static final Pattern | PLAYER_NAME_PATTERN |
| static final Pattern | SECRET_PATTERN |
| static final String | SPECIAL_CHARACTERS = "@#$%^&()!" |
| static final Pattern | VERSION_PATTERN |
| static final Pattern | ZERO_COMMA_GRID_PATTERN = Pattern.compile("^[0,]*$") |
Utility class for managing and validating text against precompiled regular expressions.
This class includes methods for password validation, semantic versioning, alphanumeric string validation, and flexible contextual validations with error handling.
The class is implemented as a Singleton using an enum to ensure a single shared instance. It uses the SLF4J logging framework for error reporting.
| String fr.softsf.sudokufx.common.util.MyRegex.getSpecialChars | ( | ) |
Returns the allowed special characters for password validation.
| boolean fr.softsf.sudokufx.common.util.MyRegex.isValidAlphanumeric | ( | final String | text | ) |
|
private |
Validates the given string against the specified regex pattern.
| text | the string to validate |
| pattern | the regex pattern to validate against; must not be null |
| textMustNotBeNullOrBlank | if true, throws an exception when text is null, empty, or blank |
true if the text matches the pattern; false otherwise | IllegalArgumentException | if textMustNotBeNullOrBlank is true and text is null, empty, or blank, or if pattern is null |
|
private |
Validates a password character buffer against strict security rules:
@#$%^&()!. @#$%^&()!. | buffer | the password character buffer to validate |
true if the password meets all criteria, false otherwise | boolean fr.softsf.sudokufx.common.util.MyRegex.isValidPlayerName | ( | final String | playerName | ) |
| boolean fr.softsf.sudokufx.common.util.MyRegex.isValidSecret | ( | final char[] | secret | ) |
Validates the given password character array against strict security rules.
Utilizes a character array to ensure memory security for sensitive data by avoiding String pool persistence.
| secret | the password character array to validate; must not be null or empty |
true if the secret meets all criteria; false otherwise | IllegalArgumentException | if secret is null, empty, or blank |
| boolean fr.softsf.sudokufx.common.util.MyRegex.isValidVersion | ( | final String | version | ) |
| boolean fr.softsf.sudokufx.common.util.MyRegex.isValidZeroCommaGrid | ( | final String | gridText | ) |
|
staticprivate |
| fr.softsf.sudokufx.common.util.MyRegex.INSTANCE |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |