If the date is not of the format mm/yy or the empty string, it should
fail. So m/yy or mm/y will fail. 

The reg exp should read: 
"a string beginning with a zero or one, followed by any digit, followed
by /, followed by any two digits - all of that zero or one times."



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] 
Sent: 29 April 2004 10:16
To: [EMAIL PROTECTED]
Subject: Re: [ cf-dev ] Reg Exp


it looks to me like your regex is looking for either 99/99, or nothing
at
all.

<cfif NOT Len(cardStartDate) OR (IsNumeric(Left(cardStartDate, 2)) AND
IsNumeric(Right(cardStartDate, 2)))>
     return true
</cfif>

not sure that's even the best logic, e.g. what if someone enters 9/04
instead of 09/04?  Perhaps you could treat it as a list with the
delimiter
being /, then check each half is numeric, maybe after trimming.




 

                    "Douglas Humphris"

                    <[EMAIL PROTECTED]        To:
<[EMAIL PROTECTED]>                                     
                    itech.net>                  cc:

                                                Subject:     [ cf-dev ]
Reg Exp                                           
                    29/04/2004 10:03

                    Please respond to

                    dev

 

 




Hi,
Can someone please help me with this regular expression ? can't figure
out
why it won't return true:

<cfset reCardDate = "^(([0-1]{1,1})([0-9]{1,1})/([0-9]{2,2})){0,1}$" />
<cfset cardStartDate = "" />
<cfoutput>#REFind(reCardDate,cardStartDate)#</cfoutput>

Basically, I want it to return true for the empty string, or for a valid
mm/yy date format.

Thanks, Douglas




-- 
These lists are syncronised with the CFDeveloper forum at
http://forum.cfdeveloper.co.uk/
Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
 
CFDeveloper Sponsors and contributors:-
*Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF
provided by activepdf.com*
      *Forums provided by fusetalk.com* :: *ProWorkFlow provided by
proworkflow.com*
           *Tutorials provided by helmguru.com* :: *Lists hosted by
gradwell.com*

To unsubscribe, e-mail: [EMAIL PROTECTED]




--
These lists are syncronised with the CFDeveloper forum at 
http://forum.cfdeveloper.co.uk/
Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

CFDeveloper Sponsors and contributors:-
*Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided by 
activepdf.com*
      *Forums provided by fusetalk.com* :: *ProWorkFlow provided by proworkflow.com*
           *Tutorials provided by helmguru.com* :: *Lists hosted by gradwell.com*

To unsubscribe, e-mail: [EMAIL PROTECTED]

Reply via email to