Don't say much, please see the specific implementation code
There ' is ' in the string ' is ': ' The Var str= ' is ' is '
;
var substr=new RegExp (' is ');//Create Regular Expression object
var result=str.replace (subStr, "");//replace ' is ' with an empty string
console.log ( result);//is th all there
are var substr=new RegExp (' is ', ' I ');//create regular Expression objects, case-insensitive
var result=str.replace (subStr , "");//replace ' is ' with an empty string
console.log (result);//this all there
are var substr=new RegExp (' is ', ' IG ');//create regular Expression object. Case-insensitive, global lookup
var result=str.replace (subStr, "");//replace ' is ' with empty string
console.log (result);//th all there
var substr=/is/ig;//Direct method to create regular expression objects, case-insensitive, global lookup
var result=str.replace (subStr, "");//replace ' is ' with an empty string
Console.log (result);//th all there
console.log (str);//is The all there is visible replace does not change original STR
The above is the entire content of this article, I hope the content of this article for everyone's study or work can bring some help, but also hope that a lot of support cloud Habitat community!