On Tue, May 22, 2012 at 2:03 PM, Summer <crazysummer2...@yahoo.com> wrote:

> Initially I did try this and it didn' work. After trying out the following
> example:
>
>  [% text = 'no, i do not believe we could not go forward to the sea. I
> know. no'; %]
>
> So, to get the count:
> [% text.match('no', 1).size %]
>
> That should match 5x, yet it shows 1 when I do .size
>

It works for me.

$ cat tmp.tt2
[% text = 'no, i do not believe we could not go forward to the sea. I know.
no'; -%]
[% text.match('no', 1).size %]
$ tpage tmp.tt2
5

What version of Template::Toolkit are you using?  I have 2.22.

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

Reply via email to