「JavaScript」replace関数の使い方
JavaScriptコード
var str = “abcdefgname=’test’sddfhskshjsfsjdfps";
var reg = /name='((\w|-|\s)+)/ig;
str.replace(reg, function() {
console.log(arguments.length); //5
console.log(arguments[1]);//test
});
Coding Changes the World
JavaScriptコード
var str = “abcdefgname=’test’sddfhskshjsfsjdfps";
var reg = /name='((\w|-|\s)+)/ig;
str.replace(reg, function() {
console.log(arguments.length); //5
console.log(arguments[1]);//test
});