Good evening everybody.
I'm trying to replace paths at *.js files using unix sed script. So, I wrote correct regex expression and sed does not fall, but I can not get a correct result.
UPD: I'm using macOS
Incoming string: import * as module from "/test"
My regex:
\s\*import(.+)from\s+\['\\"\](\\/.+)[^\n]+
that found a path pattern and returns two groups I needed (* as module and /test.js)
For example I need to change import \* as module from "/test" as import \* as module from "/myFolder/test.js"
So, but my bash command
echo 'import * as module from "/test.js"' |
sed -r "s:\s*import(.+)from\s+['\"](\/.+)[^\n]+:import \1 from \"\/myFolder\2\":g "
returns the original string! Could you help please, what's wrong with it?