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

c# SetCompatibleTextRenderingDefault must be called before the first -

c++ - Fill runtime data at compile time with templates -

C#.NET Oracle.ManagedDataAccess ConfigSchema.xsd -