java - @Pattern with Unicode script \\p{L}* doesn't work -


i have problem javax.validation.constraints.pattern @pattern validation.

@pattern(regexp = "\\p{l}*", message = "msg") private string name; 

when i'm trying input text doesn't work.

when used:

@pattern(regexp = "[a-za-z]*", message = "msg") 

it works great non latin characters.

you need make \p{l} pattern unicode aware pattern.unicode_character_class flag.

enables unicode version of predefined character classes , posix character classes.

since using string pattern, may use inline (embedded) flag variant, (?u):

regexp = "(?u)\\p{l}*" 

Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - IE9 error '$'is not defined -