Entfernen Sie das Wort aus String JavaScript
var str = "delete-this"
str.replace('delete-','') // str = "this"
Foolish Flatworm
var str = "delete-this"
str.replace('delete-','') // str = "this"
var ret = "data-123".replace('data-','');
console.log(ret); //prints: 123
var str = "That is like so not cool, I was like totally mad.";
var cleanStr = str.replace(/like/g, "");//replace every "like" with blank ""
string2 = "I love you 我爱你"
englishChars = string2.replace(/[^a-z ]/ig, "").trim().split(/\s+/);
nonEnglishChars = string2.replace(/[a-z ]/ig, "").split(/[ ]*/);
final = englishChars.concat(nonEnglishChars);
console.log(final);