Hi, I don't execute it in Tapestry, but in Javascript I use ^ and $ to
delimite the whole string.
So,
your example:

/^[0-9]{1,4}$/.test("999a")

is false !!

I hope it helps.

Lucas



On Wed, Nov 26, 2008 at 10:55 PM, Marcelo Lotif <[EMAIL PROTECTED]> wrote:
> Hi all,I was trying to build a simple regexp to validate a string formed
> only by numbers with a maximum lenght of four.
> so I came with this expression:
>
> carga_horaria-regexp=[0-9]{1,4}
>
> seems right, but tapestry's client side validation is not catching some
> patterns like this one "999a".
> I build a simple code to validate my expression directly through java
>
> import java.util.regex.Matcher;
> import java.util.regex.Pattern;
>
> public class RegReg {
>    public static void main(String[] args) {
>        Pattern p = Pattern.compile("[0-9]{1,4}");
>        Matcher m = p.matcher("999a");
>        boolean b = m.matches();
>        System.out.println(b);
>    }
> }
>
> at the end, it returns false, which means that the expression is correctly
> mounted.
>
>
> Any thoughts?
>
> --
> Atenciosamente,
>
> Marcelo Lotif
> Programador Java e Tapestry
> FIEC - Federação das Indústrias do Estado do Ceará
> (85) 3421-5910
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to