I've added @Pattern annotation to a query parameter in my rest controller (SpringBoot Kotlin). I would like the regex in the pattern to accept -
optionA or optionB or null (nothing/an empty string)
The following works, but of course does not include the empty option -
@Pattern(regexp = "(?i)optionA||(?i)optionB")
This does not work -
@Pattern(regexp = "(?i)optionA||(?i)optionB||^\\s*\$")
Can anybody help me with this? :) Thanks!