Archives: Input Validation

Java – Password Validation with Regular Expression

Password Regular Expression Pattern:


Whole combination is means, 6 to 20 characters string with at least one digit, one upper case letter, one lower case letter and one special symbol (“@#$%”). This regular expression pattern is very useful to implement a strong and complex password.

Java – Username Validation with Regular Expression

Username Regular Expression Pattern:   ^[a-z0-9_-]{3,15}$

^     # Start of the line
[a-z0-9_-]  # Match characters and symbols in the list, a-z, 0-9, underscore, hyphen
{3,15}      # Length at least 3 characters and maximum length of 15
$       # End of the line