Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
@NotNull @Pattern(regexp="[[:Alpha:]]+", message="Only Alphabetic chars allowed") protected String name;
これにより、入力としてaaaaのみが許可されます。たとえば、文字列を「apple」dosentworkに設定しようとします。ただし、文字列を「aaaaaa」に設定すると機能します。アルファベット文字のみを許可したい。
あなたが使用することができます:
@Pattern(regexp="\\p{Alpha}+", message="Only Alphabetic chars allowed")