Notepad++ 将记事本上的所有行合并为一行++;
我有以下清单: 32229_071Notepad++ 将记事本上的所有行合并为一行++;,notepad++,Notepad++,我有以下清单: 32229_071 32225_041 32225_011 32225_011 32225_011 我想让它看起来像 ‘32229_071’、‘32225_041’、‘32225_011’、‘32225_011’、‘32225_011’ 如何在记事本++中执行此操作 转到替换(ctrl+h) 搜索\r\n 取代 检查扩展(左下) 添加第一个和最后一个报价 替换 Ctrl+H 查找内容:(?:^|\G)(.+)(?:(\R)|\z) 替换为:“$1”(?2,:) 检查环绕 检查正
32225_041
32225_011
32225_011
32225_011
我想让它看起来像 ‘32229_071’、‘32225_041’、‘32225_011’、‘32225_011’、‘32225_011’ 如何在记事本++中执行此操作
- Ctrl+H
- 查找内容:
(?:^|\G)(.+)(?:(\R)|\z)
- 替换为:
“$1”(?2,:)
- 检查环绕
- 检查正则表达式
- 取消选中
*。匹配换行符
- 全部替换
(?:^|\G) # non capture group, beginning of line or restart from last match position
(.+) # group 1, 1 or more any character but newline
(?: # non capture group
(\R) # group 2, any kind of linebreak
| # OR
\z # end of file
) # end group
'$1' # content of grop 1 between single quotes
(?2,:) # conditional replace, if group 2 exists then a comma else nothing
更换:
(?:^|\G) # non capture group, beginning of line or restart from last match position
(.+) # group 1, 1 or more any character but newline
(?: # non capture group
(\R) # group 2, any kind of linebreak
| # OR
\z # end of file
) # end group
'$1' # content of grop 1 between single quotes
(?2,:) # conditional replace, if group 2 exists then a comma else nothing
屏幕截图(之前):
(?:^|\G) # non capture group, beginning of line or restart from last match position
(.+) # group 1, 1 or more any character but newline
(?: # non capture group
(\R) # group 2, any kind of linebreak
| # OR
\z # end of file
) # end group
'$1' # content of grop 1 between single quotes
(?2,:) # conditional replace, if group 2 exists then a comma else nothing
屏幕截图(之后):
(?:^|\G) # non capture group, beginning of line or restart from last match position
(.+) # group 1, 1 or more any character but newline
(?: # non capture group
(\R) # group 2, any kind of linebreak
| # OR
\z # end of file
) # end group
'$1' # content of grop 1 between single quotes
(?2,:) # conditional replace, if group 2 exists then a comma else nothing
很抱歉,我把问题放错地方了,考虑到引号的问题,你能再次检查一下吗?你应该在逗号前后加引号。然后只应添加总行的第一个逗号和最后一个逗号。这行吗?@DanielAntunes很好,然后将换行符替换为
,“
,然后手动将单个”
添加到整个事件的前后?Linux EOL呢?为什么一个步骤就足够了?嗨,如果我想在数字之间加上(),我该怎么做呢?比如('32282-P')、('32814-P')、('32883-O')、('32839-C')、('32867-X')、('32841-F')、('32886-D')@dvazantunes:在替换框中,键入:\('1'\)('1')('2,:)
。别忘了转义括号,它是特定于Notepad++的。