Was reading VS Code snippet with multiple transforms and I tried very hard, but was unable to parse how it's being done.
I have a requirement to use ${TM_FILEPATH}
and snip out everything preceding a certain point and replace all \
with /
.
For both paths of /path/to/lib/file.c
and C:\path\to\lib\file.c
, I need the results to be /lib/file.c
I have the first part done for my use case:
${TM_FILEPATH/.*lib//}
I can't seem to do the second, though. I've tried:
${TM_FILEPATH/\\/\//g}
And I need to do both. If someone answers this, could they also break it down so I can understand what's happening? I'd like to learn how to do these without having to keep asking.
g
) and cleverly use the matched groups to apply different modifications on each matched group