Hello I have this kind of data :
a;b;c;d
1;2;3;4
a;g;h;j
f;g;f;d
a;d;8;d
And I would like to modify to have this :
a;bc;d
1;23;4
a;gh;j
f;gf;d
a;d8;d
Obviously I have a lot of lines but every time the semi colons are in the same position. I tried to select the columns with notepad++ and to to replace the semi colon by nothing but the box is grey...
Do you have a solution ?
Thank you !
答案 0 :(得分:0)
Hold ALT+SHIFT and use the arrow keys to select second semicolon and delete it.
OR
Hold ALT and click and drag the mouse to select a second semicolon and delete it.
OR
^(...)(.)
\1
答案 1 :(得分:0)
Here is an online regex tester that i did the work on, you can just replace your data with the samples.
Regex : (\w+;)((\w+);(\w+))(;\w+)
答案 2 :(得分:0)
^[^;]+;[^;]+\K;
LEAVE EMPTY
说明:
^ # beginning of string
[^;]+ # 1 or more non semicolon
; # 1 semi colon
[^;]+ # 1 or more non semicolon
\K # forget all we have seen until this position
; # 1 semi colon
给定示例的结果
a;bc;d
1;23;4
a;gh;j
f;gf;d
a;d8;d
答案 3 :(得分:0)
如果数据的可能值为小写字母a-z或数字,则还可以使用捕获组和字符类[a-z0-9]
捕获前三个字符,然后再匹配分号。如果可以包含多个字符,则可以对+
[a-z0-9]+
然后替换为第一个捕获组。
查找内容
^([a-z0-9];[a-z0-9]);
替换为
$1
或者使用\K
可以找到^[a-z0-9];[a-z0-9]\K;
并将“替换为”保留为空。