I read the document and it seems that regex expression is only used in snippet body.
1 Answer
Regex's can only be used to transform snippet variables in the body of the snippet, but you can put multiple snippet prefixes like this:
"stripLastDirectory": {
"prefix": ["lsd", "lsf", "lsq"],
"body": [
"${TM_DIRECTORY/.*[\\\\|\\/]+(.*)/$1/}"
],
},
So perhaps you can accomplish what you need that way.
Another alternative with some pluses (can use javascript within the snippet!) and minuses (no support for vscode variables like ${file}) is the extension HyperSnips which does allow you to use pure regex for snippet "prefixes".