Java Mailing List Archive

http://www.gg3721.com/

Home » users.tapestry »

[T5] Possible bug in regexp

Marcelo Lotif

2008-11-26

Replies: Find Java Web Hosting

Author LoginPost Reply
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
©2008 gg3721.com - Jax Systems, LLC, U.S.A.