specialCharLength method
Calculates the number of special characters in the given value.
Parameters:
value
The string to be evaluated.
Returns:
The count of special characters in the string.
Implementation
int specialCharLength(String value) {
return regex.allMatches(value).length;
}