perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From allen haim <al...@netherrealm.net>
Subject Form Validation
Date Wed, 22 Jun 2005 21:06:12 GMT
Gerald, is it possible this is a bug:

I notice that your validation for the Number type uses this regex:

/^\s*[0-9+-.][0-9.eE]*\s*$/

However, that fails on a value such as 9.516e-5, which is a valid float.

I believe you need to add a negative sign to the second character class:

/^\s*[0-9+-.][0-9.eE-]*\s*$/

This regex is still a little too lax, because it will allow malformed numbers
like 

9.5e5e-3 

through. 


--------

Also, I am successfully using the following rule:

$rules = [
    [
        -key    => 'user_seq',
        -name   => 'User-inputted sequence',
        emptyok     => 1,
        -msg => 'blah blah blah',
        matches_regex       => "^\\s*(>.+\\n)?[\\s$NT]+\$",
    ]
];

Note that it's 'matches_regex', not 'matches_regex_js'. In the docs it says
that this shouldn't work on the client side, but it does.

What is the difference between perl regular expressions and javascript ones?

Yours

Allen

p.s. The SetupSession/GetSession stuff is working great -- I will have more
to say on that in a bit. 

-- 



slash is the only person who deserves a slash.  

-stephen handley


---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Mime
View raw message