1 Reply Latest reply on Oct 19, 2011 4:17 PM by nbelaevski

    Bean Validation, @Pattern, and CSV


      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 ValueClient side BVServer Side BV
      " asb1"matchno match
      "1asb"matchno 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:

      1. Always prepend a "^" character in the javascript regex (if it isn't already present)
      2. File an upstream issue with Bean Validation


      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.