var str = 'asd-0.testing'; var regex = /asd-(\d)\.\w+/; str.replace(regex, 1);
替换整个字符串str用1.我希望它替换匹配的子字符串而不是整个字符串.这可能在Javascript中吗?
str
1
javascript regex replace substring
javascript ×1
regex ×1
replace ×1
substring ×1