通常我有以下情况:
有一个带有属性列表的 PONO 类。

    public string UserName
    {
        get { return this.userName; }
        set { if (this.userName != value) { SetDirty(); this.userName = value; } }
    }

    public string Password
    {
        get { return this.password; }
        set { if (this.password != value) { SetDirty(); this.password = value; } }
    }

    public string Email
    {
        get { return this.email; }
        set { if (this.email != value) { SetDirty(); this.email = value; } }
    }

    public string Title
    {
        get { return this.title; }
        set { if (this.title != value) { SetDirty(); this.title = value; } }
    }

是否有工具,最好是 Notepad++ 或 VS 插件,将正则表达式输出提取到另一个文件中?

例如:查找:"public string (.*)$"结果:
UserName
Password
Email
Title

在一个新文件中。

最佳答案

在 Notepad++ 中使用 Search/Find 对话框并在 Mark 选项卡中选中 Bookmark line 复选框 - 在 Mark all 之后,您将在所有所需行上添加书签。

最后一步是Search/Bookmark/Copy bookmarked lines 并将它们粘贴到一个新文件中,您可以在其中删除public string 部分。

从 v5.8.7 更新日志:

  • 为了减少混淆,在“查找/替换”对话框中为“全部标记”功能创建了新的“标记”选项卡。

  • 我猜 Bookmark line 复选框和 Mark all 放在 v5.8.6 中的另一个选项卡中。

    关于regex - 什么文本编辑器支持将找到的结果提取到另一个文件中?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/5350675/

    10-14 15:45
    查看更多