Quote:
Originally Posted by rdyornot
Thank you - I was afraid of something like this. I'm trying to get the first one or two words from a book or series title - so i'm afraid as far as characters go anything but a space just won't work. If the function won't take a regex or escape character I'll just have to find some other work around.
|
What you have is almost there. It is putting a space in place of the question mark:
Code:
{series:sublist(0,2, )}
That gets the first two words of the series. And to be clear, there is a space between the comma and the right parenthesis.
But, as @chaley mentioned, there are three modes. I don't like the above version. I would use General Program mode:
Code:
program:
sublist($series, 0, 2, " ")
I can read that and understand it, and there is no reliance on exact formatting of the template.
You could do this with regex:
Code:
program:
re($series, "^(.*? .*?\s).*", "\1")
Or maybe
Code:
program:
re($series, "^(.*?[\s:].*?[\s:]).*", "\1")
If you want to allow any white space or a colon as the separator. Which of the above is suitable depends on what it is you are trying to do.