I am starting work with ESAPI but I have a problem. I am trying to create an example rule (Validator.Single=[A-Z]$). I validate if a String only have an uppercase character.
I put Validator.Single=[A-Z]$ in the validator.properties file but when I use in the code:
System.out.println(v.isValidInput("Single", "A", "Single", 1, true));
The output tells me
SecurityConfiguration for Validator.Single not found in ESAPI.properties. Using default:
false
And returns me a false, against of a true, because the "A" is a valid letter.
Anyone knows what more I nedd to do? Or I make the rule bad?
Thanks for your responses.
Your
Validator.Single=[A-Z]$
should have been
Take note of the caret character (^) in the beginning of the regex. You can read more about Java Regular Expressions in Lars' Java Regex Tutorial