given the following text, I'd like to replace the spaces within the parentheses with '-'
str = 'these are the (1st 2nd and last) places'
// expected result
// 'these are the (1st-2nd-and-last) places'
In other words, replace all the spaces that are preceded by a '(' and (something) and followed by (something) and a ')'.
I started with
/(?<=\(\w+)\s/g
but (regex101 tells me that) "a quantifier inside a lookbehind makes it s non-fixed width" (referring to the \w+). What is a better approach to solving this?