替换在Sublime Text& Visual Studio代码

发布于 2025-01-26 04:11:28 字数 837 浏览 3 评论 0原文

我想在这两个IDE,崇高的文本和Visual Studio代码中更换命名的捕获组。而且,我实际上成功地使用了Intellij Webstorm。

一个示例语料库是:

Title: Hamlet
Genre: Tragedy
Playwright: Williams Shakespere

Title: Woyzeck
Genre: Tragedy
Playwright: Karl Georg Büchner

我使用以下等级来检索剧作家

Playwright: (?<playwright>.*)

,然后用以下等级替换为XML格式包装,以进行进一步的分析,

<playwright>${playwright}</playwright>

同时崇高文本和Visual Studio代码在此结果中失败了:

Title: Hamlet
Genre: Tragedy
<playwright>${playwright}</playwright>

Title: Woyzeck
Genre: Tragedy
<playwright>${playwright}</playwright>

当WebStorm提供正确的结果时

有人知道如何使用这两个IDE做到这一点吗?

I would like to do the replacement of the named capture group in these two IDE, Sublime Text and Visual Studio Code. And, I actually succeed in using IntelliJ WebStorm.

An example corpus was:

Title: Hamlet
Genre: Tragedy
Playwright: Williams Shakespere

Title: Woyzeck
Genre: Tragedy
Playwright: Karl Georg Büchner

and I used the following RegEx to retrieve the playwright

Playwright: (?<playwright>.*)

and replace this with the following RegEx to wrap in an XML format for the further analysis

<playwright>${playwright}</playwright>

Both Sublime Text and Visual Studio Code failed with this outcome:

Title: Hamlet
Genre: Tragedy
<playwright>${playwright}</playwright>

Title: Woyzeck
Genre: Tragedy
<playwright>${playwright}</playwright>

While WebStorm delivered the right results

Does anyone know how to make it with these two IDEs?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

缘字诀 2025-02-02 04:11:28

在sublimetext中,替换模式 名为backRefreferences ,并且应该像

<playwright>$+{playwright}</playwright>

Visual Studio代码一样,命名为Backreferences是不支持 在替换模式中(功能请求没有收集足够的社区upvotes)。

In SublimeText, the replacement pattern can contain named backreferences and should look like

<playwright>$+{playwright}</playwright>

In Visual Studio Code, named backreferences are not supported in the replacement patterns (the feature request did not collect enough community upvotes).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文