1

I want to keep only the word before the first dot:

user.entity.ts

Current code:

${TM_FILENAME_BASE/([^.]+)/${1:/upcase}/}

Unfortunately, this does only transforms the first part, rather than split it out:

USER.entity
asked Dec 25, 2020 at 21:04

1 Answer 1

6

Just use this:

"body": ["${TM_FILENAME_BASE/([^.]+).*/${1:/upcase}/}"],

the idea being that your version kept the entity part because it wasn't part of the match - the middle part ([^.]+) in your snuippet.

Since it wasn't part of the match it goes through unchanged, as it should. So I made it part of the match

([^.]+).*

and now since it isn't part of the replacement, it will be removed.

answered Dec 25, 2020 at 21:34
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.