Arm interview question

Write a Java program to check validity of a given string pattern.