← Quiz: Validation and Errors: all 10 questions
Quiz: Validation and Errors · Question 10 of 10
Which annotation checks a string against a regular expression?
Which annotation checks a string against a regular expression?
- A.@Size
- B.@Pattern(regexp = ...)
- C.@NotBlank
- D.@Min
Answer & explanation
Correct answer: @Pattern(regexp = ...)
@Pattern validates the format, such as a PIN code with exactly 6 digits.
Can you get the rest right without peeking?
Take the timed Quiz: Validation and Errors quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →