I’m trying to create a regex for a custom VS Code snippet I’m writing. Im taking the file name that’s in camel case format and modifying it so a hyphen separates each word (before the uppercase letter) and then transforms the entire thing to lowercase. For example, if my file name was titled myFileName
, the result would be my-file-name
. Appreciate the help in advance!
I’m able to create the expression for hyphenating between words with ([a-z])([A-Z])/$1-$2/
but I’m not positive the if that’s the best way to do that. After that expression I’m not able to then transform to lower case