js regex replace with capture group code example
Example 1: replace with regex capture group
print(readline().replace(/(\d+)(.) ?/g,(a,b,c)=>c.repeat(b)))
Example 2: replace with regex capture group
str.replace(/(?<=name="\w+)\d+(?=\w+")/, '!NEW_ID!') // look behind & look ahead