How can I obtain this string ’32-32-434234′ from ‘3232434234’ using a regex? [duplicate]

So I have this normal string obtained from an input ‘3232434234’ and I need to transform it with a mask into ’32-32-434234′ as the user is typing.

What is the correct regex to use in str.replace(regex, ‘-‘)?

I have tried this regex const regex = /^d{2}-d{2}-d{6}$/; but it didn’t work