I'm building code snippets for VS Code. For a specific angular directive I need to lowercase the first letter of a previous placeholder:
<ng-container [bsInstanceof]="item">
<ng-container *bsInstanceofCase="Ava; let ava">{{ Ava.a }}</ng-container>
<ng-container *bsInstanceofCase="Bebe; let bebe">{{ Bebe.b }}</ng-container>
<ng-container *bsInstanceofCase="Cece; let cece">{{ Cece.c }}</ng-container>
<ng-container *bsInstanceofDefault>No match</ng-container>
</ng-container>
At the moment, I have the following code snippet (Marketplace):
"InstanceOf": {
"prefix": "bs-instance-of",
"description": "Template-driven `instanceof` switch-case",
"body": [
"<ng-container [bsInstanceof]=\"${1:item}\">",
"\t<ng-container *bsInstanceofCase=\"${2:A}; let ${2/(.*)/${1:/uncapitalize}/}\">{{ ${2/(.*)/${1:/uncapitalize}/}.${3:a} }}</ng-container>",
"\t<ng-container *bsInstanceofCase=\"${4:B}; let ${4/(.*)/${1:/uncapitalize}/}\">{{ ${4/(.*)/${1:/uncapitalize}/}.${5:b} }}</ng-container>",
"\t<ng-container *bsInstanceofCase=\"${6:C}; let ${6/(.*)/${1:/uncapitalize}/}\">{{ ${6/(.*)/${1:/uncapitalize}/}.${7:c} }}</ng-container>",
"\t<ng-container *bsInstanceofDefault>${8:No match}</ng-container>",
"</ng-container>"
]
},
which, according to this answer and comments, should totally work. But the value of the placeholder is just being copied as-is:
Note that the comments in the linked question, state that the index before /uncapitalize
is the regex match group index.
Why is this not working as expected?