Question

I'm writing a sublime text snippet,

I want to insert a string which removes the header and tailer of the file path and replace the slashes with dots.

e.g.

input: '/workspace/proto/src/app/dashboard/scrum/burnDownChart.js'

output: 'dashboard.scrum.burnDownChart'

The depth of the file is unknown.

I have written ${TM_FILEPATH/^.*app\/(.*)\.js$/\1/} to remove the header and tailer

And I have written ${TM_FILEPATH/\//./g}' to replace the slash

But I cannot find a way to chain the operations or to nest one in another

I've tried ${${TM_FILEPATH/^.*app\/(.*)\.js/\1/}/\//\./g} , but it simply gives /\//\./g}

Was it helpful?

Solution

You can write a Macro to chain a couple of commands like the ones you described together. check them out here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top