Monday, 15 May 2017

string regex replace in node js

I'm having the below string in my node js.

var textToReplace = "Your <b class =\"b_1\">1</b> payment due is $4000.Your 
<b class =\"b_1\">2</b> payment due is $3500. Your <b class =\"b_1\">3</b> 
payment due is $5000.";

Here I want to replace <b class =\"b_1\">*</b> with ''. The output is Your payment due is $4000.Your payment due is $3500. Your payment due is $5000..

If this is a normal replace I wouldn't have had any problem, but here I think the best way to replace is by using Regex. This is where I'm confused. In java we have a stringVariableName.replaceAll() method. please let me know how can I do this.

Thanks



via user3872094

No comments:

Post a Comment