//单个 var aa="1-2-3"; aa=aa.replace(',',"."); console.log(aa);
//Global replacement
var aa="1-2-3"; aa=aa.replace(/-/g,"."); console.log(aa);
var text ="hello [Word]"; var aaa=text.match(/([^\[\]]+)(?=\])/g) console.log(aaa);
The above is the detailed content of The replace function replaces individual and global usage methods. For more information, please follow other related articles on the PHP Chinese website!