Reg-ex help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hey guys,

I'm trying to write a regular expression to match a tag for my frameworks template engine. I seem to be having some trouble. The expression should match:

{:seg 'segname':}
{:seg 'segname' cache:}

What I have is...

$fSegRegEx = "#\{:seg \'[a-z0-9\-\_]{3,}\'( cache)?:\}#i";

Which when run against my test data, seems to match:

"{:seg 'segname' cache:}"
" cache"





For arguments sake, I'll provide the whole code snippet...

   preg_match($fSegRegEx, $this->msOpCont, $faSegMatches);

   /* faSegMatches ==

    * array

    * 0 => '{:seg 'users_online' cache:}'//

    * 1 => ' cache'//

    */

     while ( $fMatch = current($faSegMatches) ) {

/*
        * Expected:

        * $fMatch[0] = "{:seg "

        * $fMatch[1] = Segment Name

*
        * $fMatch[2] = " cache:}"

        * or

        * $fMatch[2] = " :}"

        */

       $faMatch  = explode("'", $fMatch);

       //...

       //...

       next($faSegMatches);

     }// End While


Thanks guys.  This has been bugging me for a couple days.
- Craige


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux