I have a string like:
image.id."HashiCorp Terraform Team <[email protected]>"
AND image.label."some string"."some other string"
I want to replace all spaces with '___' just for the strings that are surrounded with quotes, so the final string will look like:
image.id."HashiCorp___Terraform___Team___<[email protected]>"
AND image.label."some___string"."some___other___string"
I've tried this:
text = text.replace(/"(\w+\s+)+/gi, function (a) {
return a.replace(' ', _delimiter);
});
But it only replaces the first space, so i get:
HashiCorp___Terraform Team <[email protected]>.
and some___other string
I'm very bad with regexp so I'm probably doing something wrong :(