4

通常我有以下情况:有一个带有属性列表的 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

在一个新文件中。

4

2 回答 2

7

在 Notepad++ 中使用Search/Find对话框并在Mark选项卡中选中Bookmark line复选框 -Mark all在所有所需行上都有书签之后。 在此处输入图像描述

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

从 v5.8.7 更新日志:

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

我猜该Bookmark line复选框并被Mark all放置在 v5.8.6 中的另一个选项卡中。

于 2011-03-18T10:44:58.667 回答
1

不是文本编辑器解决方案,而是

grep "public string .+$" < file | sed "s/public string (.+)$/\1/" > out

应该管用。未经测试。

于 2011-03-18T10:58:48.853 回答