How do js regular expressions match and replace text using the replace method?

for example: abdsdsdfsdf1526614206112164350fskdfskdf1526614199681037404bcmvbcvbmcnvz: match 1526614206112164350 and 1526614199681037404 in the string, add quotation marks on both sides, and process it as follows: abdsdsdfsdf "1526614206112164350" fskdfskdf "1526614199681037404" bcmvbcvbmcnvz,
I can match such numbers now, but I don"t know how to use replace. Please write me an example. Thank you.


is that so

str = 'abdsdsdfsdf1526614206112164350fskdfskdf1526614199681037404bcmvbcvbmcnvz'
str.replace(/\d+/g,function(item){return '"'+item+'"' })

clipboard.png


str.replace (/\ dbadger G, "\" $&\ ");

Menu