Replace a specific keyword in a string with another keyword

How to replace a word in a string in the Anqi CMS template?

replaceThe filter can replace the old word 'old' with the new word 'new' in a string and return the new string.If old is empty, it will match at the beginning of the string and after each UTF-8 sequence.If new is empty, remove old.

Usage Instructions

replaceUsage of the filter:

# 将旧的关键词替换为新的关键词
{{obj|replace:"old,new"}}

Comma separates 'old' and 'new'.

{{"欢迎使用安企CMS"|replace:"安企,anqi"}}
# 显示结果
欢迎使用anqiCMS

Here is an example demonstration

{{"欢迎使用安企CMS"|replace:"安企,anqi"}}
# 显示结果
欢迎使用anqiCMS
{{"欢迎使用安企CMS"|replace:",-"}}
# 显示结果
-欢-迎-使-用-安-企-C-M-S-
{{"欢迎使用安企CMS"|replace:"安企,"}}
# 显示结果
欢迎安企CMS