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


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



Reply via email to