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 more

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
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/) To

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 the

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 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 page if

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-intuitive things

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

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 strtotime( $whatever );

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 regular expression such as to

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

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 regexp ... Hi, Had

Re: [PHP] Filters and sanitizing a regexp

2008-09-25 Thread Bastien Koert
Subject: Re: [PHP] Filters and sanitizing a regexp ... 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

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