Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To modify a VS Code snippet to convert a label to lowercase using regex, you can use the following code:

"toLowercaseLabel": {
        "prefix": "lc",
        "body": [
            "${1/([A-Z])/${1:/downcase}/g}"
        ],
        "description": "Convert label to lowercase using regex"
}

In this code, the regex ([A-Z]) captures any uppercase letters in the label. The ${1:/downcase} replacement transforms the captured letter to lowercase. The g flag applies the replacement to all occurrences of uppercase letters in the label.

To use the snippet, type lc followed by the label you want to convert to lowercase, and then press tab.