【发布时间】:2022-01-02 23:49:55
【问题描述】:
在 Liquid 中,可以像这样从液体字符串中删除字符 X,
{{ 'random_string' | remove:'X' }}
例如{ 字符可以通过这种方式删除。
但是,以这种方式删除 } 字符会产生以下错误,
Liquid syntax error (line 15): Variable '{{ 'random_string' | remove:"}' was not properly terminated with regexp: /\}\}/
这可能与 Liquid 语言中 } 字符的使用有关。
问题
如何从字符串中删除} 字符?
【问题讨论】:
-
您是否只是尝试通过在 } 前添加 \ 来逃避它?