var a = "Text(money ='3/3/dollor',unit=42)";
我想去掉 money ='3/3/dollor',
使用javascript,如何做到这一点?
抱歉,我没有说清楚,money = 之后的字符串可以是任何东西,但它们肯定是字符串,并且总是以逗号结尾。
更多样本
var a = "Text(money ='v23f3/.3/dollor',unit=42)";
var a = "Text(money ='3/3fds/d.ollor',unit=42)";
var a = "Text(money ='3.3.3.3/3/d.o/l.lor',unit=42)";
var a = "Text(money ='3/3/dollor',unit=42)";
我需要的输出是a = "Text(unit=42)"
最佳答案
a = a.replace(/money ='.*',/, "");
关于javascript - 使用 JavaScript 更改字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4120526/