0

I have a following string in a configuration file:

path: (node) =>  `/${node.locale === 'en-US' ? 'en' : 'zh'}/${node.slug}`

I need to replace a fragment with a blank in some scenarios. The replacement will be done using sed on Linux just before build is triggered. Fragment to be replace is from the start of the / to the first }

/${node.locale === 'en-US' ? 'en' : 'zh'}

Unfortunately, I can get it to match the entire string all the way to the second }, but cant figure out how to make it stop.

Here is my sed command:

sed 's/\/\${node\.locale.*?}/hello/' gridsome.config.js

If I remove ? it does work, but catches the entire line which won't work for this scenario.

radek
  • 11

0 Answers0