I want to validate a string which allows only alpha numeric values and only one dot character and only underscore character in java .
String fileName = (String) request.getParameter("read");
I need to validate the fileName retrieving from the request and should satisfy the above criteria
I tried in "^[a-zA-Z0-9_'.']*$" , but this allows more than one dot character
I need to validate my string in the given scenarios ,
1 . Filename contains only alpha numeric values . 2 . It allows only one dot character (.) , example : fileRead.pdf , fileWrite.txt etc 3 . it allows only underscore characters . All the other symbols should be declined
Can any one help me on this ?