notepad++ - 在记事本++上将所有行合并为一个
问题描述
我有以下列表:
32229_071
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,:)
- 检查 环绕
- CHECK 正则表达式
- 取消选中
. matches newline
* - Replace all
解释:
(?:^|\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
屏幕截图(之前):
屏幕截图(之后):
推荐阅读
- php - 使用 get_post_meta 将 unix 时间戳更改回 mysql 日期时间
- python - 使用 qml 中的元素显示的 python 中的数组
- apache-nifi - 在 Apache NiFi 中,如何使用时区以 ISO 格式打印当前日期
- json - 如何将 ndarray 响应从烧瓶服务器发送到 python 客户端?
- sql - 默认主键索引或用户创建索引,在Oracle中将优先执行
- c# - 迭代 IEnumerable 时删除一项
- python - 如何将csv文件中的数字提取到变量中
- python - 在 Python 中使用装饰器进行线程化
- android - 有没有办法使用firestore获取数组长度
- angular - 如何将 routerlinkactive 与功能一起使用