I have some files with names starting with core-
and following one or more words separated by hyphen, like this:
core-query
core-query-pagination
core-query-pagination-numbers
I'm creating a VS Code Snippet to transform the file name to get this result:
QUERY
QUERY PAGINATION
QUERY PAGINATION NUMBERS
core-
-
with
What I've got so far is this:
"${TM_FILENAME_BASE/([^-]+)(-*)/${1:/capitalize}${2:+ }/g}"
Output:
Core Query Pagination Numbers
Please check if the following works for you:
${TM_SELECTED_TEXT/(^core-)|(-)|([a-z]*)/${2:+ }${3:/upcase}/gm}
You can use the following if you do not need to remove the -
.
${TM_SELECTED_TEXT/^core-(.*)/${1:/upcase}/gm}