开发者

Regex search for Smarty template

I have some fields with names such as:

home_phone
company_phone
mobile_phone
other_phone_c
personal_phone_c

And I have a Smarty variable to populate input values with the field values:

value="{$fields.{{$prefix}}_phone}"

But the ones with the suffix _c are not outputting, since they don't match the pattern.

Is there a way to append some kind of regex so that it will look for values that either end after the phone or with _c, something like:

{$fields.{{$prefix}}_phone{regex | ($|_c$)开发者_如何学JAVA}}"


Use this: .*_(?:phone|phone_c)$

It will match desired strings, which ends with _phone or phone_c.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜