var str = 'asd-0.testing'; var regex = /asd-(\d)\.\w+/; str.replace(regex, 1);
That replaces the entire string str with 1. I want it to replace the matched substring instead of the whole string. Is this possible in Javascript?
str
1