This discussion relates to the JIRa issue RF-11531.
If you have a backing bean, annotated with @Pattern(regexp = "[a-z].*"), then the validation on the server and client disagree. The server side seems to assume the "begins with" character "^". Let me summarize the behavior with a table:
For: @Pattern(regexp = "[a-z].*")
|Test Value||Client side BV||Server Side BV|
|" asb1"||match||no match|
IMO the client-side is doing the correct thing, since the pattern doesn't begin with the "^" character. If we do add this character as in: @Pattern(regexp = "^[a-z].*"), then the client and server-side agree on all counts.
As I see it, there are 2 options moving forward:
I'm trying to get a hold of someone from the BV spec, to nail down the expected behavior. If anyone can point to some clear/authoritative docs that would help resolve this, I'd very much appreciate it.
According to http://download.oracle.com/javaee/6/api/javax/validation/constraints/Pattern.html , it checks for match, not contains, so IMHO client-side validation seems to be wrong.
Here is the simple program: http://pastebin.com/Qv8K3hs7 that prints:
asb1 matches: true contains: true
1asb matches: false contains: true
asb matches: true contains: true
|Retrieving data ...|