Re: A small problem

From: Date: Tue, 11 Mar 2003 13:09:40 +0000
Subject: Re: A small problem
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-139128@lists.php.net to get a copy of this message
Oo. i matched all html tags too. make that: preg_match_all("|<\?[^>]+\?>|",$Text,$PHP_code); At 14:06 11-3-03, you wrote:
At 13:56 11-3-03, you wrote:
Can you pick a decent subject like "help with regular expressions" rather than something pointless and generic like "a small problem"... a lot of readers will skip over generic subject lines, and you also miss out on attracting the attention of those who regexps well.
a good suggestion. however i saw it anyway, i would suggest to try this: <?PHP
$Text="<?    echo \"aaaa\"; ?> This is some other no php code <?    echo \"this is PHP\";?>";
preg_match_all("|<[^>]+>|",$Text,$PHP_code); //Note that preg_match_all puts the matches in array $PHP_code[0].
        //output
for ($i=0;$i<count($PHP_code[0]);$i++)
        { echo "<br>$i:".htmlspecialchars($PHP_code[0][$i]);
        }
?> Oh and regular expressions are more clever than you would think, it's just that they can do so much more than you think. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.general (#139128) next »