I have an input field where a SIM number has to be entered. For that field in the bean I put the following validation expression:
@Pattern( regexp = "^(?:\\d{19})$", message = "{validation.notValidSIMNumber}" )
which should be "only 19-digit numbers are accepted".
I expected that if the field is left empty, the validation would also claim.
But instead there is no error message...
EDIT: Sorry, I wrote the false regex (with | at the end). So, to be clear: I need to validate an input field and it must be a 19-digit number. No possibility to leave it empty.
With the above regex, if I leave it empty I get no error message, but as soon as I enter something that's not a 19-digit number I get the error message.


|. It means "or". Since you have nothing after it, it will validate empty string@NotNull, but I just thought that the@Patternis "stronger" and could include the first too...