Mathew Robertson wrote:
I was looking through H::T when I noticed that it splits the incoming template using:

split ( /(?<=)/ , $template)

This regex ends up splitting on every '<'.

I have modified my version to use:

split( m!(?=<(?:\!--\s*)?/?[Tt][Mm][Pp][Ll]_)! , $template)

which thus matches only on <TMPL_ and </TMPL_ tags.


Won't this break if you use the <!-- TMPL... --> constructs of putting the TMPL tags within HTML comments?


Not from my testing it didn't; this regex only matches on:

   <TMPL_
   </TMPL_
   <!-- TMPL_
   <!-- /TMPL_

doesn't matter where the TMPL_ construct is located.

However you could be right as there may be some cases where the regex doesn't quite match correctly, although I cant think of such a situation.

Ah, now I see. I read the text you wrote instead of the regex because, you know, I'm not a regex engine. ;)


Of course *had* I properly read the regex you wrote, I would have figured it out.

Couldn't you use a case-insensitive match though to avoid the [Tt][Mm][Pp][Ll] part?


Pete





------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click _______________________________________________ Html-template-users mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/html-template-users

Reply via email to