![]() |
SudokuFX
|
Utility class for managing and validating text against precompiled regular expressions. More...
Collaboration diagram for fr.softsf.sudokufx.common.enums.MyRegex:Public Member Functions | |
| Pattern | getAlphanumericPattern () |
| Pattern | getSecretPattern () |
| Pattern | getVersionPattern () |
| boolean | isValidatedByRegex (final String text, final Pattern pattern) |
| Validates the given text against the specified regex pattern. | |
Public Attributes | |
| INSTANCE | |
Private Member Functions | |
| boolean | isValidPassword (final String password) |
| Validates a password string against strict security rules: | |
Static Private Attributes | |
| static final Pattern | ALPHANUMERIC_PATTERN = Pattern.compile("^[a-zA-Z0-9\\s.]+$") |
| Precompiled regex pattern for validating alphanumeric strings. | |
| static final Logger | LOG = LoggerFactory.getLogger(MyRegex.class) |
| static final Pattern | SECRET_PATTERN |
| Precompiled regex pattern for validating passwords. | |
| static final String | SPECIAL_CHARACTERS = "@#$%^&()!" |
| Allowed special characters for password validation. | |
| static final Pattern | VERSION_PATTERN |
| Precompiled regex pattern for semantic versioning (e.g., X.Y.Z format). | |
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.
| Pattern fr.softsf.sudokufx.common.enums.MyRegex.getAlphanumericPattern | ( | ) |
| Pattern fr.softsf.sudokufx.common.enums.MyRegex.getSecretPattern | ( | ) |
| Pattern fr.softsf.sudokufx.common.enums.MyRegex.getVersionPattern | ( | ) |
| boolean fr.softsf.sudokufx.common.enums.MyRegex.isValidatedByRegex | ( | final String | text, |
| final Pattern | pattern ) |
Validates the given text against the specified regex pattern.
If pattern equals the internal secret pattern, a stricter password validation is performed via isValidPassword(String).
| text | the text to validate; must not be null or blank |
| pattern | the regex pattern to validate against; must not be null |
true if the text matches the pattern or meets password criteria;
false otherwise | IllegalArgumentException | if text is blank or pattern is null |
Here is the call graph for this function:
|
private |
Validates a password string against strict security rules:
@#$%^&()!. @#$%^&()!. | password | the password to validate; must not be null or blank |
true if the password meets all criteria, false otherwise | IllegalArgumentException | if password is null or blank |
|
staticprivate |
Precompiled regex pattern for validating alphanumeric strings.
Requirements: - Only letters, digits, spaces, and dots are allowed.
| fr.softsf.sudokufx.common.enums.MyRegex.INSTANCE |
|
staticprivate |
|
staticprivate |
Precompiled regex pattern for validating passwords.
Requirements: - Only letters (lowercase/uppercase), digits, and special characters #$%^&()! are allowed. - Exactly 24 characters in total.
|
staticprivate |
Allowed special characters for password validation.
|
staticprivate |
Precompiled regex pattern for semantic versioning (e.g., X.Y.Z format).
Requirements: - Major, minor, and patch versions must be non-negative integers. - Each version component must be separated by a '.' character.