Since Erlang OTP 20.0 you can use string:replace/3 function from string module. string:replace/3 - replaces SearchPattern in String with Replacement. 3rd function parameter indicates whether the leading, the trailing or all encounters of SearchPattern are to be replaced.
3条答案
按热度按时间lsmepo6l1#
您可以使用re模块。Erlang shell中的示例如下:
同样,如果你要匹配大数据,re2可能会有帮助,尽管它是NIF库。
p4rjhz4m2#
如果这是您的特定用例-更改文件名-您可以执行以下操作:
kninwzqo3#
Since Erlang OTP 20.0 you can use string:replace/3 function from string module.
string:replace/3 - replaces SearchPattern in String with Replacement. 3rd function parameter indicates whether the leading, the trailing or all encounters of SearchPattern are to be replaced.