将选定的内容从一张记事本++复制到另一张

时间:2017-07-20 06:35:52

标签: macros notepad++

我有一个数据,管道分开了。

1|2|3|4|5|6|7|8|9|10| 

我必须复制并粘贴(到新工作表)管道6 - 9之间的那个 我有10,000行像这样

我们怎么做?我们怎样才能为它写一个宏?还有其他解决方案吗?

1 个答案:

答案 0 :(得分:2)

将整个文本复制到新缓冲区,然后编辑文本以删除不需要的部分。可以使用正则表达式替换所有^(?:[^|\r\n]*\|){5}([^|\r\n]*)\|.*$\1

解释

^                   - start of line
(?:                 - start of a non-capturing group
    [^|\r\n]*       - zero or more characters that are not a | or newlines or carriage returns
    \|              - a |
){5}                - exactly 5 occurences of the previous group
             -- the efect of the above is to match the unwanted leading  characters
([^|\r\n]*)         - a group containing the characters to keep
             -- the wanted part of the line is saved in capture group 1
\|.*$               - a | then everything else to the end of the line
             -- matches the unwanted right-hand part of the line

最终$并非严格需要。但是,当考虑开头^时,它用于记录正则表达式查看整行。

相关问题