开发者

Change string using JavaScript

开发者 https://www.devze.com 2023-01-24 11:06 出处:网络
var a = \"Text(money =\'3/3/dollor\',unit=42)\"; I want to get rid ofmoney =\'3/3/dollor\', Using javascript, how to do this?
var a = "Text(money ='3/3/dollor',unit=42)";

I want to get rid of money ='3/3/dollor',

Using javascript, how to do this?

Sorry I did not make this very clear, the string after money = can be anything but they are string for sure, and always ends up with an comma.

More samples

var a = "Text(money ='v23f3/.3/do开发者_C百科llor',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)";

The output I need is a = "Text(unit=42)"


a = a.replace(/money ='.*',/, "");
0

精彩评论

暂无评论...
验证码 换一张
取 消