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
Ellie G
2591 gold badge4 silver badges12 bronze badges
1 Answer 1
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
Mark
191k32 gold badges555 silver badges577 bronze badges
Sign up to request clarification or add additional context in comments.