📜  tpl 正则表达式任何数字 - 任何代码示例

📅  最后修改于: 2022-03-11 14:59:10.083000             🧑  作者: Mango

代码示例1
{$your_string|regex_replace:"/[0-9]/":"text you want to replace with"}

PAY ATTENTION
Ex: the string is: 'test.com/foo123-test/' and you use:
{$your_string|regex_replace:"/[0-9]/":"bar"}

The result will be 'test.com/foobarbarbar-test/'
beacuse it match three times the regex rule

If you want to replace the full '123' part you can add another char to makes the match unique, like:
{$your_string|regex_replace:"/[0-9]+-/":"bar"}
        this is needed to ADD char-^^-this is the added char