PHP Classes

Regular Expressions and Form Class

Recommend this page to a friend!

      PHP Forms Class with HTML Generator and JavaScript Validation  >  PHP Forms Class with HTML Generator and JavaScript Validation package blog  >  How to Show Google Ma...  >  All threads  >  Regular Expressions and Form Class  >  (Un) Subscribe thread alerts  
Subject:Regular Expressions and Form Class
Summary:ValidateRegularExpression From Validation problems
Messages:2
Author:Chris Grafix
Date:2006-04-14 13:10:09
Update:2006-04-14 18:35:33
 

  1. Regular Expressions and Form Class   Reply   Report abuse  
Picture of Chris Grafix Chris Grafix - 2006-04-14 13:10:10
Hi,
I have a couple of regular expressions that although I have tested them with a Regex Editor for functionality, they won't work in conjunction with the form generation class.

"ValidateRegularExpression"=>"(?!^[0-9]*$)(?!^[a-zA-Z]*$)^([a-zA-Z0-9]{8,15})$",
This regular expression causes a Warning: ereg() [function.ereg]: REG_BADRPT

"ValidateRegularExpression"=>"^(\+\d{1,4}[-. ])?[\(]?(\d{1,5})[\)]?[-. ](\d{2,4})?[-. ]?(\d{4,5})[-. ]?((#|x|ex|ext|extension)[-. ]?(\d{3,4}))?$",
This regular expression validates always to 'no match' regardless of the input.

I would appreciate any input on this problem.

Thank you very much for your consideration.

Sincerely,

Chris
PANOSPHERIC Virtual Imaging

  2. Re: Regular Expressions and Form Class   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2006-04-14 18:35:33 - In reply to message 1 from Chris Grafix
Those are not valid POSIX regular expressions. You are using Perl regular expression syntax but Javascript only supports POSIX regular expressions.