首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >将选定的内容从一张notepad++中复制到另一张

将选定的内容从一张notepad++中复制到另一张
EN

Stack Overflow用户
提问于 2017-07-20 06:35:51
回答 1查看 902关注 0票数 0

我有一个数据是管道分开前。

代码语言:javascript
运行
复制
1|2|3|4|5|6|7|8|9|10| 

我必须复制和粘贴(到新的纸张),只有在管道6-9之间,我有10,000行像这样

我们怎么能这么做?我们如何为相同的宏编写宏?还有别的解决办法吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-07-20 09:42:58

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

解释

代码语言:javascript
运行
复制
^                   - 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

严格来说,不需要最终的$。但是,当考虑到开头的^时,它可以记录正则表达式查看整行。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/45206975

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档