3

I'm attempting to limit the length of a displayed string to the first 50 characters plus any needed to end at the next word boundary. I'm using the regex_replace filter in the template tag to replace all the characters after the pattern match with "...". However, using the positive lookbehind requires the less-than symbol which apparently MT is interpreting as the start of a tag. This is causing nearby tags to break and the template fails to publish, reporting an error. It there any way to incorporate the positive lookbehind into the template?

<mt:Ignore>Limit entryTitle length by discarding any/all chars after whole word containing 50th char</mt:Ignore>
<mt:entryTitle regex_replace="/((?<=.{50}\b).+)/i","...">
4

1 回答 1

0

这是一个 XML 问题:标签中的“<”字符是非法的。将其编码为&lt;

<mt:entryTitle regex_replace="/((?&lt;=.{50}\b).+)/i","...">
于 2014-05-16T20:57:03.880 回答