Re: [PHP] Filters and sanitizing a regexp

2008-09-26 Thread Eric Butera
On Fri, Sep 26, 2008 at 12:23 PM, Nathan Rixham <[EMAIL PROTECTED]> wrote: > Eric Butera wrote: >> >> On Fri, Sep 26, 2008 at 12:03 PM, Richard Lynch <[EMAIL PROTECTED]> wrote: -Original Message- > > hate to say this but why not cater for all eventualities and just use >>>

Re: [PHP] Filters and sanitizing a regexp

2008-09-26 Thread Nathan Rixham
Eric Butera wrote: On Fri, Sep 26, 2008 at 12:03 PM, Richard Lynch <[EMAIL PROTECTED]> wrote: -Original Message- hate to say this but why not cater for all eventualities and just use strtotime( $whatever ); Well it just doesn't have enough geek factor... Plus, strtotime() does non-int

Re: [PHP] Filters and sanitizing a regexp

2008-09-26 Thread Eric Butera
On Fri, Sep 26, 2008 at 12:03 PM, Richard Lynch <[EMAIL PROTECTED]> wrote: >> -Original Message- >> > hate to say this but why not cater for all eventualities and just use >> > strtotime( $whatever ); >> >> Well it just doesn't have enough geek factor... > > Plus, strtotime() does non-intui

RE: [PHP] Filters and sanitizing a regexp

2008-09-26 Thread Richard Lynch
> -Original Message- > > hate to say this but why not cater for all eventualities and just use > > strtotime( $whatever ); > > Well it just doesn't have enough geek factor... Plus, strtotime() does non-intuitive things with some inputs... I'd insist on at least some kind of confirmation p

Re: [PHP] Filters and sanitizing a regexp

2008-09-26 Thread Jason Pruim
On Sep 26, 2008, at 7:23 AM, Richard Heyes wrote: Well it just doesn't have enough geek factor... So true it hurts Mr Heyes Lol. and very nice work on the RGraph! just noticed it in your tag - having a good read now :) Thanks. Sad that IE8 won't (I think) support the canvas tag. Though

Re: [PHP] Filters and sanitizing a regexp

2008-09-26 Thread Richard Heyes
>> Well it just doesn't have enough geek factor... > > So true it hurts Mr Heyes Lol. > and very nice work on the RGraph! just noticed it > in your tag - having a good read now :) Thanks. Sad that IE8 won't (I think) support the canvas tag. Though Chrome, Firefox, Safari and Opera do and it's in

Re: [PHP] Filters and sanitizing a regexp

2008-09-26 Thread Richard Heyes
> hate to say this but why not cater for all eventualities and just use > strtotime( $whatever ); Well it just doesn't have enough geek factor... -- Richard Heyes HTML5 Graphing for FF, Chrome, Opera and Safari: http://www.phpguru.org/RGraph -- PHP General Mailing List (http://www.php.net/) T

Re: [PHP] Filters and sanitizing a regexp

2008-09-26 Thread Nathan Rixham
Richard Heyes wrote: Hi, I don't think that one is quite right... Your optionals (?) are confusing. Why [0-3]?[0-9] AND the \d? No reason. Why [0-9] at all (since \d is essentially [0-9])? Again, no reason. Why use the discarded capture group (?:) since the [0-3] is already optional?

Re: [PHP] Filters and sanitizing a regexp

2008-09-26 Thread Richard Heyes
Hi, > I don't think that one is quite right... Your optionals (?) are > confusing. Why [0-3]?[0-9] AND the \d? No reason. > Why [0-9] at all (since \d is > essentially [0-9])? Again, no reason. > Why use the discarded capture group (?:) since the > [0-3] is already optional? It makes it look

Re: [PHP] Filters and sanitizing a regexp

2008-09-25 Thread Micah Gersten
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 dat

Re: [PHP] Filters and sanitizing a regexp

2008-09-25 Thread Bastien Koert
> > Cc: Frank Stanovcak; php-general@lists.php.net > > Subject: Re: [PHP] Filters and sanitizing a regexp > > > > > ... > > > > Hi, > > > > Had to have a play with this. Here's my (somewhat stricter) regex: > > > > preg_match(

RE: [PHP] Filters and sanitizing a regexp

2008-09-25 Thread Boyd, Todd M.
> -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On > Behalf Of Richard Heyes > Sent: Thursday, September 25, 2008 2:28 PM > To: Boyd, Todd M. > Cc: Frank Stanovcak; php-general@lists.php.net > Subject: Re: [PHP] Filters and sanitizing a rege

Re: [PHP] Filters and sanitizing a regexp

2008-09-25 Thread Richard Heyes
> ... Hi, Had to have a play with this. Here's my (somewhat stricter) regex: preg_match('/((?:[0-3]?[0-9])?\d)-([0-1]?\d)-20\d\d/', '31-12-2000', $matches); if (!empty($matches[1]) AND $matches[1] > 31) $matches = array(); if (!empty($matches[2]) AND $matches[2] > 12) $matches = array(); You co

RE: [PHP] Filters and sanitizing a regexp

2008-09-25 Thread Boyd, Todd M.
> -Original Message- > From: Frank Stanovcak [mailto:[EMAIL PROTECTED] > Sent: Thursday, September 25, 2008 12:41 PM > To: php-general@lists.php.net > Subject: [PHP] Filters and sanitizing a regexp > > Is it possible to use the php filter function to sanitize a regu

[PHP] Filters and sanitizing a regexp

2008-09-25 Thread Frank Stanovcak
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 shou