Regex help please

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

 



I'm normally OK with regex, especially if I fiddle with it long enough,
however I have fiddled with this one so long that I'm either totally
missing it or it's something simple.  Does it have anything to do with
the backref, or the fact that the value of the backref has a $?  I have:

$out = '
{$sites}
<tr>
	<td>
	{Site.id}
	</td>
</tr>
{/$sites}';

And I want to capture the first {$tag}, everything in between and the
last {$/tag}.  I have tried several things and here is my current regex
that looks like it should work, but doesn't:

preg_match_all('|{\$([^}]+)}(.+)({/\1})|Us', $out, $matches);


Gives:

Array
(
    [0] => Array
        (
        )

    [1] => Array
        (
        )

    [2] => Array
        (
        )

    [3] => Array
        (
        )

)

-- 
Thanks!
-Shawn
http://www.spidean.com

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