regex replace js but with capture group code example
Example 1: replace with regex capture group
str.replace(/(.*name="\w+)\d+(\w+".*)/, "$1!NEW_ID!$3")
Example 2: replace with regex capture group
str.replace(/(?<=name="\w+)\d+(?=\w+")/, '!NEW_ID!') // look behind & look ahead