This content has been marked as final.
Show 2 replies
-
1. Re: Seam + a4j:support re-rendering + Hibernate Validator @Pattern
cmoerz.seam.ny-central.org Feb 5, 2009 1:38 PM (in response to vitorsouzabr)Hi there,
what I did to get it going: I did use @Pattern, but I extended it with a
||()
this way, it also permits an empty string. E.g. my phone number pattern looks like this:
@Pattern(regex="^((\\+\\d{1,3}(-| )?\\(?\\d\\)?(-| )?\\d{1,5})|(\\(?\\d{2,6}\\)?))(-| )?(\\d{3,4})(-| )?(\\d{4})(( x| ext| \\/|\\/)\\d{1,5}){0,1}$||()", message="Invalid phone number")
hth
chris -
2. Re: Seam + a4j:support re-rendering + Hibernate Validator @Pattern
vitorsouzabr Jul 23, 2009 5:55 PM (in response to vitorsouzabr)Hi, thanks for the response! I didn't touch this project for quite a while, and now that I've resumed working on it, I tried your suggestion, but it still didn't work.
I also tried the pattern
[0-9]{5}-[0-9]{3}|^$
but also no good. Funny thing is
"".matches("[0-9]{5}-[0-9]{3}|^$")
returns true. The pattern is correct. Someone else is screwing up or maybe Hibernate Validator doesn't work like String.matches()...
Thanks anyways,
Vítor Souza