Hi Summer -

On Tue, 20 Apr 2010 22:09 -0400, "Darren Chamberlain"
<d...@sevenroot.org> wrote:
> 
> On Tue, Apr 20, 2010 at 21:57, Summer <crazysummer2...@yahoo.com> wrote:
> 
> > FOREACH newstr IN thistxtstring.split( '||' );
> 
> split takes a regex, so you need to escape the |:
> 
> FOREACH newstr IN thistxtstring.split( '\|\|' );

Darren is correct (as usual).  Just to explain a bit more in case it's
not obvious what was happening:

The argument to TT split() is a pattern.  '|' is the OR operator, so
splitting on the pattern '||' is like saying to split on "<empty> OR
<empty> OR <empty>".  Splitting on empty is a special case in Perl that
splits a string into individual characters, like you were seeing:

   http://perldoc.perl.org/functions/split.html


HTH,
Larry

_______________________________________________
templates mailing list
templates@template-toolkit.org
http://mail.template-toolkit.org/mailman/listinfo/templates

Reply via email to