I have a little issue with pattern for java bean validation. I have a pattern for my variable inside java class
@Pattern(regexp = "[\\p{Upper}]+[\\p{Space}]?[\\p{Upper}]+[\\p{Punct}]?[\\p{Upper}]+[\\p{Digit}]?.", message = "")
private String name;
And actually it's working, but now I have to add a range {0,32} to uppercase words. When I added [A-Z]{0,32} it breaks down
The name should fit values below
- PROFILE - true
- P - true
- PRO - true
- PROFILEPROFILEPROFILEPROFILEPROF - true
- PROFILEPROFILEPROFILEPROFILEPROFI - false
- profilename - false
- PROFILE1 - true
- PROFILE100 - true
- PROFILE1000 - true
- PROFILE1000000 - true
- 1111 - false
- PROFILEPROFILE123456789PROFILE123 - false
- profile_name - false
- *^^@ - false
- PROFILE NAME - true
- PROFILE_NAME - true
- PROFILE. - true
- &)12p - false
- 11PROFILE - true
- 1234PROFILE - true
- $%#PROFILE - true
- nothing - false
Aucun commentaire:
Enregistrer un commentaire