我有以下大量随机数据
1231286234|453|1234|xxx|aabbc|xcvxcvxcv|xcvxcvxcv|Xcvxcvxcv
1231286234|453|1234|xxx| aabbc|xcvxcvxcv|xcvxcvxcv|Xcvxcvxcv
1231286234|453|1234|xxx |aabbc|xcvxcvxcv|xcvxcvxcv|Xcvxcvxcv
1231286234|453|1234|xxx | aabbc|xcvxcvxcv|xcvxcvxcv|Xcvxcvxcv
行数很大,数据是随机的,我希望它们像
1231286234|453|1234|xxx aabbc|xcvxcvxcv|xcvxcvxcv|Xcvxcvxcv
1231286234|453|1234|xxx aabbc|xcvxcvxcv|xcvxcvxcv|Xcvxcvxcv
1231286234|453|1234|xxx aabbc|xcvxcvxcv|xcvxcvxcv|Xcvxcvxcv
1231286234|453|1234|xxx aabbc|xcvxcvxcv|xcvxcvxcv|Xcvxcvxcv
答案1
这适用于您提供的示例。
Find what: (\w*\|\w*\|\w*\|\w*)([\|\s]*)([\w\|]*)
Replace with: \1 \3
Search mode: Regular expression
答案2
- Ctrl+H
- 找什么:
^(?:[^|]+\|){3}.*?\K\h*\|\h*
- 替换为:
<-- 一个空格
- 查看 环绕
- 查看 正则表达式
- 取消选中
. matches newline
- Replace all
解释:
^ # beginning of line
(?: # start non capture group
[^|]+ # 1 or more non pipe
\| # a pipe, have to be escaped as it's special character for regex
){3} # end group, must appear 3 times
.*? # 0 or more any character but new line, not greeedy
\K # forget all we have seen until this position
\h* # 0 or more horizontal spaces
\| # a pipe, have to be escaped as it's special character for regex
\h* # 0 or more horizontal spaces
屏幕截图(之前):
屏幕截图(之后):