note 41020 rejected from function.preg-split by vincent

From: Date: Fri, 26 Mar 2004 22:27:06 +0000
Subject: note 41020 rejected from function.preg-split by vincent
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-67214@lists.php.net to get a copy of this message
Note Submitter: skibobdi@hotmail.com ---- Hi there, I am having currently making a template system in php to try and excel my coding skills a bit and i'm having a bit of a problem, I've already spent hours trying to figure it out - with no success :((... the specific problem is this: I am extracting my html template file into a $string (this bit works ok as i've checked the $string afterwards).. a portion of my template file looks like so: <TABLE> <MYTAG_LOOP NAME='NAV_LINKS'> <TR><TD> <A HREF="<SIMP_LOOP_VAR NAME='URL'>" TARGET="<SIMP_LOOP_VAR NAME='TARGET'>"><SIMP_LOOP_VAR NAME='NAME'></A> </TD> </TR> <br> </MYTAG_LOOP> </TABLE> then I use a regular expression to chop up the string into portions of MY_TAG's and html&text, like this: $exp = '/([<+](\/)?MYTAG_+[^>]*[>+])+/'; $split_template_block = preg_split($exp, $string, -1, PREG_SPLIT_NO_EMPTY|PREG_SPLIT_DELIM_CAPTURE); Now when I do a var_export($split_template_block), I get the following structure, notice the extra '/' that has been added at key 11, I can't for the life of me stop it from doing this!! :S 1 => '<TABLE>' 2 => '<MYTAG_LOOP NAME=\'NAV_LINKS\'>' 3 => '<TR><TD> <A HREF="' 4 => '<MYTAG_LOOP_VAR NAME=\'URL\'>' 5 => '" TARGET="' 6 => '<MYTAG_LOOP_VAR NAME=\'TARGET\'>' 7 => '">' 8 => '<MYTAG_LOOP_VAR NAME=\'NAME\'>' 9 => '</A> </TD> </TR> <br>' 10=> '</MYTAG_LOOP>' 11=> '/' 12=> '</TABLE>' Any help from anyone, would be very greatly significantly appreciated..Andy. skibobdi@hotmail.com

« previous php.notes (#67214) next »