Re: Filters and sanitizing a regexp

From: Date: Fri, 26 Sep 2008 00:40:36 +0000
Subject: Re: Filters and sanitizing a regexp
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-280944@lists.php.net to get a copy of this message
I'd return an error. You can use this function to make sure they entered a valid date: http://us.php.net/checkdate Provide a template like: (Month/Day/Year) or for EU (Day/Month/Year) If it's not valid, return an error and let them fix it. Chances are, if they entered more characters than a date, the date you parse might not be the one that they wanted. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Frank Stanovcak wrote: > Is it possible to use the php filter function to sanitize a regular > expression such as to return just the date part of a string that may be > passed by an nonobservant user? > > "#\d\d/\d\d/\d\d\d\d#" > > input would be something like > as02/05/2008df > > I want to use the filter to give me just the date should some oaf not leave > the date field as just digits. > > > >

« previous php.general (#280944) next »