I've to substitute the string blacklist:[/^\/_/,/\/[^\/?]+\.[^\/]+$/]
with
blacklist: [/^\/_/,/\/[^\/?]+\.[^\/]+$/, /\/first|\/second|\/third/]
in a file.
I would like to use sed
command to do it in shell.
I opted to use ~ as separator and I tried with variables but nothing happened.
Example:
VarA="blacklist: [/^\/_/,/\/[^\/?]+\.[^\/]+$/]"
VarB="blacklist: [/^\/_/,/\/[^\/?]+\.[^\/]+$/, /\/first|\/second|\/third/]"
sed "s~$VarA~$VarB~" service-worker.js
Could you help me please? Thanks