How can I get the relative_filepath without the extension and backslash change ?
I found two transforms:
"${RELATIVE_FILEPATH/[\\]/\//g/}""${RELATIVE_FILEPATH/(.js)//}"
If the relative file path is \aaa\bbb\ccc.js
I tried this:
/${RELATIVE_FILEPATH/((.js))}|/[\\]/${1://}${2://g/}/}
I want to get text like this: /aaa/bbb/ccc
Thank you.
marc_s
759k185 gold badges1.4k silver badges1.5k bronze badges
-
thank for correct words.이병옥– 이병옥2025年02月24日 01:43:04 +00:00Commented Feb 24 at 1:43
1 Answer 1
Try this snippet:
"Remove extension and swap to forward slash": {
"prefix": "t2",
"body": [
// "${RELATIVE_FILEPATH}",
"/${RELATIVE_FILEPATH/.js|(\\\\)/${1:+\/}/g}",
],
"description": ""
},
Note the double escapes in .js|(\\\\) are necessary.
And I added the + to the ${1:+\/}.
answered Feb 22 at 3:24
Sign up to request clarification or add additional context in comments.
1 Comment
이병옥
thank you for your help. Thanks to you you saved me time. Your code works correctly. ^^
Explore related questions
See similar questions with these tags.