I've got a simple regex, which should match only letters and numbers in last 4 chars of string:
([a-zA-Z0-9]{4}$)
It works perfectly in online tester, but doesn't match if i use it with hibernate validation annotation on field:
@NotNull
@Length(min = 4, max = 25)
@Pattern(regexp = "([a-zA-Z0-9]{4}$)")
private String test;
For example, it returns false for 1234.5678-abC2 string
Could you help me?
.character. Add\\.within the[]..not supposed to be matched. I'm not sure that i understand you correctly. Coluld you please give an example?