Re: Help with ereg()

From: Date: Wed, 12 Mar 2003 20:56:22 +0000
Subject: Re: Help with ereg()
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-139181@lists.php.net to get a copy of this message
¡¡¡¡¡¡¡¡¡¡¡ Got it !!!!!!!!!! It even matches the linebreaks, so it can color multi-line code. Look at this sample: ------------- TEXT TO USE FOR SEARCHING PATTERNS ------------------------------ <? phpinfo(); ?> <? echo "PHP IS A GREAT PROGRAMMING LANGUAGE"; ?> <? // :-) mysql_connect("localhost","root","big_brother_is_watching"); ?> -------------------------- END TEXT ------------------------------------------------------- Script used to get all of the matches: preg_match_all("/(<\?.*\?>)/ims",$HebraPadre["texto"],$codigo_fuente_padre); echo "<pre>"; echo highlight_string($codigo_fuente_padre[1][0], TRUE); echo highlight_string($codigo_fuente_padre[1][1], TRUE); echo highlight_string($codigo_fuente_padre[1][2], TRUE); echo "</pre>"; And it works quite OK I removed the (\ at the beginning, and added the "s" to the end. Thanks, without your tip I was real lost. It was while reading this http://php.benscom.com/manual/es/pcre.pattern.syntax.php that i realized how to do it. Thanks very much fLIPIS

« previous php.general (#139181) next »