I am building my own snippet in vscode.
I am not the best with regex so I was using chatgpt to help me build regex.
However, I am unable to create a regex that will convert my file name such as:
AppInput.tsx
into app-input
Currently, I have this expression TM_FILENAME_BASE/[^0-9a-z]+//gi
for converting my file name:
AppInput.tsx
into AppInput
Looking for a solution.
2
Answers
Try this variable
This works on file names like
App.tsx
,AppInput.tsx
.,AppInputMore.tsx
, etc. for any number of groups in the filename:${2:+-}
is a conditional, only if there is a capture group 2 add the following-
.