How to validate a string value using regex (Regular Expression)