我有几条连接在一起的线,我想把它们分开。
之前几行的示例:
:user1:[email protected]:4082e6739d188208d2450d1e03696b40:OdoA>D9e9VIOnP8^}M[e*FA)3!:Frankosh:[email protected]:1bf4e6d1462b89977cf774c3dc1c666f:|Lt&A/+?%My._Ft+Tw1B7(?'[Sw/F5
:user2˜…:[email protected]:ac9ae85d0ad2f6328507bac7357dfdf4:(;J`#PQVde}),G*WoV%y&7:]:calefonaso:[email protected]:08598769c7ee559e792be4d04e931140:7TJL|O}c:2YhJq?0[?4coLT~XjW"xm
:Ruziitto:[email protected]:fe71d6e50e0bb767a19e176c0d26eaed:rOSMJ|?~Y*jAp1#P\,p)h)t:s:killer87:[email protected]:4316edd511ea5d8b2a67748ded316497:z(=3;m#y0:+$WS\jY6u@!\WFyt{\Ia
之后的行示例:
:user1:[email protected]:4082e6739d188208d2450d1e03696b40:OdoA>D9e9VIOnP8^}M[e*FA)3!
:Frankosh:[email protected]:1bf4e6d1462b89977cf774c3dc1c666f:|Lt&A/+?%My._Ft+Tw1B7(?'[Sw/F5
:user2˜…:[email protected]:ac9ae85d0ad2f6328507bac7357dfdf4:(;J`#PQVde}),G*WoV%y&7:]
:calefonaso:[email protected]:08598769c7ee559e792be4d04e931140:7TJL|O}c:2YhJq?0[?4coLT~XjW"xm
:Ruziitto:[email protected]:fe71d6e50e0bb767a19e176c0d26eaed:rOSMJ|?~Y*jAp1#P\,p)h)t:s
:killer87:[email protected]:4316edd511ea5d8b2a67748ded316497:z(=3;m#y0:+$WS\jY6u@!\WFyt{\Ia
答案1
假设冒号是分隔符并且数据中没有冒号:
- Ctrl+H
- 找什么:
^((?::[^:]+){4}):
- 用。。。来代替:
$1\n:
- Replace all
解释:
^ : begining of line
( : start group 1
(?: : start non capture group
: : a colon
[^:]+ : 1 or more any character that is not a colon
){4} : end group, must appear 4 times
) : end group 1
: : a colon (To be sure to not add superfluous line break)
替代品:
$1 : The content of group 1 (the first fourth columns in a line)
\n : a line break, you could use \r\n for windows
: : colon, at the beginig of new lines
- 检查匹配大小写
- 检查环绕
- 检查正则表达式
- 请勿检查
. matches newline
给定示例的结果:
:user1:[email protected]:4082e6739d188208d2450d1e03696b40:OdoA>D9e9VIOnP8^}M[e*FA)3!
:Frankosh:[email protected]:1bf4e6d1462b89977cf774c3dc1c666f:|Lt&A/+?%My._Ft+Tw1B7(?'[Sw/F5
:user2˜…:[email protected]:ac9ae85d0ad2f6328507bac7357dfdf4:(;J`#PQVde}),G*WoV%y&7
:]:calefonaso:[email protected]:08598769c7ee559e792be4d04e931140:7TJL|O}c:2YhJq?0[?4coLT~XjW"xm
:Ruziitto:[email protected]:fe71d6e50e0bb767a19e176c0d26eaed:rOSMJ|?~Y*jAp1#P\,p)h)t
:s:killer87:[email protected]:4316edd511ea5d8b2a67748ded316497:z(=3;m#y0:+$WS\jY6u@!\WFyt{\Ia