Class Regex
java.lang.Object
com.luchersol.core.util.Regex
Utility class containing commonly used regular expression patterns.
This class provides reusable String constants representing validated
regex patterns for typical validation scenarios such as numbers, identifiers,
and network addresses.
All patterns are designed to be used with Pattern
and Matcher.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringMatches one or more digits.static final StringMatches a Spanish DNI (Documento Nacional de Identidad).static final StringMatches hexadecimal numbers, optionally prefixed with0xor0X.static final StringMatches a valid IPv4 address.static final StringMatches a valid IPv6 address (compressed and full forms).static final StringMatches strings containing at least one special character. -
Method Summary
-
Field Details
-
SPECIAL_CHARACTERS
Matches strings containing at least one special character.Special characters included:
! @ # $ % ^ & * ( ) , . ? " : { } | < >Example matches:
hello!pass@word
- See Also:
-
DIGIT
Matches one or more digits.Equivalent to:
[0-9]+Example matches:
123007
- See Also:
-
HEXADECIMAL
Matches hexadecimal numbers, optionally prefixed with0xor0X.Example matches:
FF0x1A3F
- See Also:
-
DNI
Matches a Spanish DNI (Documento Nacional de Identidad).Format:
- 8 digits
- 1 uppercase letter
Example match:
12345678ZNote: This pattern validates only the format, not the correctness of the control letter.
- See Also:
-
IPV4
Matches a valid IPv4 address.Each octet must be between
0and255.Example matches:
192.168.1.18.8.8.8
- See Also:
-
IPV6
Matches a valid IPv6 address (compressed and full forms).Supports:
- Full notation
- Compressed notation (::)
Example matches:
2001:0db8:85a3:0000:0000:8a2e:0370:73342001:db8::1
- See Also:
-