Hi,

I am using regular expressions in a php program to decide what should be
done next. I am having a problem with one of my regex's. The following
is the code i am using:



for( $i = 0; $i < sizeof( $arg ); $i++ )
{
        if( $arg[$i] == '' )
        {
                continue;
        }
                
        if( preg_match( "/^\d{4}-\d{4}$/", $arg[$i], $matches ) )
        {
                $season = $matches[0];
        }
        elseif( preg_match( "/^[a-zA-Z]+$/", $arg[$i], $matches ) )
        {
                if( ! isset( $display ) )
                {
                        $display = $matches[0];
                }
        }       
        elseif( preg_match( "/^\d+$/", $arg[$i], $matches ) )
        {
                $value = $matches[0];
        }
        elseif( preg_match( "/(div\d|prem)/", $arg[$i], $matches ) )
        {
                $division = $matches[0];
        }echo $arg[$i]."***<br>"; 
                echo $division;
}



The first 3 work fine, but the last one "/(div\d|prem)/" doesnt work
properly. It does work if I have say div1, but if I have prem it doesnt
work at all. I have tried changing the regex so it only contains
"/prem/" and it still doesnt work. can anyone tell me what is wrong with
this code, or is it just a bug in my version of php?

Thanks in advance,

Lee Stretton.

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