
나는 다음과 같은 거대한 무작위 데이터를 가지고 있습니다
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
화면 캡처(이전):
화면 캡처(이후):