Re: [htmltmpl] H::T chunking of templates
Brought to you by:
samtregar
From: Mathew R. <mat...@re...> - 2004-03-04 22:16:04
|
> > I was looking through H::T when I noticed that it splits the = incoming template using: > >=20 > > split ( /(?<=3D)/ , $template) > >=20 > > This regex ends up splitting on every '<'. > >=20 > > I have modified my version to use: > >=20 > > split( m!(?=3D<(?:\!--\s*)?/?[Tt][Mm][Pp][Ll]_)! , $template) > >=20 > > which thus matches only on <TMPL_ and </TMPL_ tags. > >=20 >=20 > 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. cheers, Mathew |