尝试使用 javascript 正则表达式将所有重复的选项卡新行替换为单个新行。使用一些在线测试仪显示它可以工作。但它不是在 JavaScript 中。有人可以帮忙
var str;
str.replace(/[\t \n,]+/, ",");
input: UIPLAT-234 UIPLAT-342,UIPLAT-3452<\t>UIPLAT-23<\n>UIPLAT-55
the above <\t> and <\n> represent the input of a tab and new line
最佳答案
您需要添加全局标志:
str.replace(/[\t \n,]+/g, ",");
关于javascript正则表达式将所有重复的选项卡新行替换为单个新行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47059346/