How to globally replace pipe symbol “|” in string

前端 未结 5 1353
北恋
北恋 2020-12-06 05:25

How can I globally replace the | (pipe) symbol in a string? When I try to replace it with \"so|me|str|ing\".replace(/|/g, \'-\'), I get \"-s-

5条回答
提交回复
热议问题