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 <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to