Home > other >  VSCode Snippet Help/Chaining transform
VSCode Snippet Help/Chaining transform

Time:02-12

I thought I was getting the hang of making my own snippets, but I can't figure out to transform a tab stop so that 'Ignore/Before/Slashes/Oh Hey Text' becomes 'OhHeyText'.

so far I have this

${4/.*\\/(. $)/$1/g}

or

${4/\\s//g}

But I can't figure out how to chain the transforms together. I've read through 5 or 6 posts here on SO already, but I'm having a lot of trouble grokking the actual transformation syntax, and extrapolating that to my use case.

Thanks for any help you can give!

CodePudding user response:

You can use

"${TM_DIRECTORY/^.*[\\/\\\\]|\\s //g}"

See the regex demo. Details:

  • ^.*[\/\\] - start of string, any zero or more chars other than line break chars as many as possible, and then / or \
  • | - or
  • \s - one or more whitespaces.
  • Related