Re: JSP form beginner question

From: VisionSet (spam_at_ntlworld.com)
Date: 10/15/03


Date: Wed, 15 Oct 2003 11:16:15 +0100


"Paul Lutus" <nospam@nosite.zzz> wrote in message
news:voq4c5gac2ml09@corp.supernews.com...
> VisionSet wrote:
>
> < snip >
>
> > or you could validate the input with regEx
> >
> > if(!intParam.matches("[0-9]*")) return null;
>
> Cool test. Accept zero or more digits. How could it fail?
>
> String intParam = "";
> System.out.println(intParam.matches("[0-9]*"));
>
> Result: true
>
> You want:
>
> if(!intParam.matches("[0-9]+")) return null;

Indeed.

--
Mike W


Relevant Pages

  • Re: Awk Regex Syntax / Flavor?
    ... and is this an Awk-specific regex feature? ... I can look up in the Awk docs if I ... If the current record consists entirely of digits and spaces ... variable to zero. ...
    (comp.lang.awk)
  • Re: Reg exp question
    ... > I'm trying to validate a number field that has to be exactly six digits ... > cannot start with a zero: ... Prev by Date: ...
    (microsoft.public.dotnet.languages.vb)
  • Reg exp question
    ... I'm trying to validate a number field that has to be exactly six digits and ... cannot start with a zero: ... Prev by Date: ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Width | Height Regular Expression
    ... between one and three digits: ... I need a regex to validate a valid height or width. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: How to increase Working Precision?
    ... I don't get credit for letting "generally outstanding" slip by? ... and 9.95, with three correct digits. ... It printed as zero because it ... is deemed to have too little precision to print otherwise ...
    (sci.math.symbolic)