@rebl: You cannot nest functions in
single function mode, what you called "simple" mode. It is also difficult to distinguish between an argument containing a comma and the argument separator comma. Because of this, you *really* want to use
template program mode (TPM) or
general program mode (GPM). Both give you the possibility of nesting function calls. Both distinguish between commas in strings and commas used as argument separators. TPM is better for small expressions needed in larger templates. GPM is better when complexity is high, when you want to be able to more easily read the code, or when constant strings in the template contain { and } characters.
Your example in GPM:
Code:
program:
re(shorten(field('comments'), 50, '...', 50), '<.*?>','')
Your example in TPM:
Code:
{comments:'re(shorten($, 50, '...', 50), '<.*?>','')'}
In both cases HTML stripping won't work if the tag contains a string containing a > character. That situation is rather hard to deal with in regular expressions.
EDIT: trumped (somewhat) by eschwartz. To answer your question about how you "get into program mode", you simply begin the template with the word "program:"