Re: RegExp help..

From: Date: Mon, 12 Mar 2001 08:33:50 +0000
Subject: Re: RegExp help..
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-43435@lists.php.net to get a copy of this message
Try this: $ ereg("^([0-9]{2})[0-9]{2}([0-9]{2}).*", $var, $hits) if ($hits[1] == themonth && $hits[2] == theyear) { do_the_stuff } What it does is that it puts the first two digitst into $hits[1], skips the two nextcoming digits and finally puts the next two numbers into $hits[2] /Fredrik >>>>>>>>>>>>>>>>>> Ursprungligt meddelande >>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<< John Vanderbeck <agathorn@cfl.rr.com> skrev 2001-03-12, kl. 02:40:25 angående ämnet [PHP] RegExp help..: > I really wish I could figure these darn things out :) I have a task I need > to do, and i'm certain I could do this easily with a regexp.. > I have a file name in the format MMDDYY-*.txt...I need to parse it to > determine if the month and year matches a specified month and year. Day is > irrelevant > Can any of your regexp wizards help me? > Thanks! > - John Vanderbeck > - Admin, GameDesign > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#43435) next »