VSCODE摘要正则是提取目录和替换斜线?
我正在努力寻找一个Vscode Transformation Regex,让我采用这样的字符串:myproject.api/data/randompath/entities/user.ts
和生产:myproject.api.data.randompath.entities
我可以在两个通过中获得此功能;一个用于删除最后一个斜线和文件名,另一个用点替换斜线。不幸的是,VSCODE片段不允许链接,我还没有弄清楚如何将这两个传球组合成一个。
任何帮助都很好,谢谢!
I'm struggling to find a VSCode transformation regex that allows me take a string like this:MyProject.Api/Data/RandomPath/Entities/User.ts
and produce:MyProject.Api.Data.RandomPath.Entities
I can get this working in two passes; one to remove the last slash and filename, and another to replace the slashes with dots. Unfortunately VSCode snippets don't allow chaining, and I haven't been able to figure out how to combine these two passes into one.
Any help would be great, thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我得到了它!不漂亮;但这是如下:
/[\\/\\\\] \\ w+\\。 w+\\。\\ w+$)|(\\ w+(\\。\\ w+)?)| \\。 $ {1}/g
I got it! It's not pretty; but here it is as follows:
/[\\/\\\\]\\w+\\.\\w+$|(\\w+)(?:[\\/\\\\]\\w+\\.\\w+$)|(\\w+(\\.\\w+)?)|\\.|[\\/\\\\]/${2}${2:+.}${1}/g