RE: [PHP] Help with ereg()

From: Date: Tue, 11 Mar 2003 13:32:35 +0000
Subject: RE: [PHP] Help with ereg()
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-139129@lists.php.net to get a copy of this message
Use preg_match_all(); Something like preg_match_all("/(\(<\?.*\?>)/im", $Text, $Array_PHP_Code, PREG_PATTERN_ORDER); should do it. It might need some work, but you'll get it. :) Niklas -----Original Message----- From: Alejandro [mailto:alejandro@grupobk.com] Sent: 11. maaliskuuta 2003 14:59 To: php-general@lists.php.net Subject: [PHP] Help with ereg() Hi all. I'm trying to deal with Regular Expressions, but somehow it is getting more difficult. I´m trying to do the folowing: Read a text and get all of the PHP code out of it, highlight it and then print all in nice HTML. I'm using this to get the PHP code: ereg("<\?.*\?>",$Text,$PHP_code); It works, yeah, but on a situation like this: <? echo "aaaa"; ?> This is some other no php code <? echo "this is PHP"; ?> Thanks anyway ########################################### This message has been scanned by F-Secure Anti-Virus for Internet Mail. For more information, connect to http://www.F-Secure.com/

« previous php.general (#139129) next »