2
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/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)";

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

1
  • 1
    @user469652: The single quoted substring (money = '...') could contain commas? Commented Nov 8, 2010 at 1:10

1 Answer 1

2
a = a.replace(/money ='.*',/, "");
Sign up to request clarification or add additional context in comments.

2 Comments

I need a generic way to do this, the string after "money =" could be anything.
@user469652 - you need to be more specific about all the possible combinations, words, letters there are. provide like 5-10 different examples of strings.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.