I have many files with the many of the following forms:
export function foo(payload={}) {
return { type: bar, payload };
}
I would like to do a regex-replace
that removes the spaces between the brackets so that the above becomes (note the removed spaces in the return clause):
export function foo(payload={}) {
return {type: bar, payload};
}
In regex-builder
I can get matches with the following:
"{ \\(.*?\\) }"
But when I try to do any kind of regex-replace
across the file, with a replace pattern like {\1}
I get 0 matches.
Flummoxed.
.*
matches any chars except newlines, which includes brace chars. (And please show exactly what you tried. That can help others help you.)"{\\s+\\([^}]*\\)\\s+}"
instead?\\
means a backslash,\n
means a newline etc.