How to find the first space in all lines?
-
I have a txt file with more than 3 thousand lines, I want to detect the first space in all lines and add a ]
Original file format[fgggj oooo m6cmp5
[5jgidd udd64j kkrt7 8d66sdjnd
[hfhfh maoerchgu 996d63542
[mmnkiiuy45 oiudzzc3Would be like this
[fgggj]oooo m6cmp5
[5jgidd]udd64j kkrt7 8d66sdjnd
[hfhfh]maoerchgu 996d63542
[mmnkiiuy45]oiudzzc3Next, use a regex that eliminates everything outside []
Final result
[fgggj]
[5jgidd]
[hfhfh]
[mmnkiiuy45]It’s possible? Thank you for any help.
-
Find what :
^(\S++)[^\r\n]++
Replace with :$1]
-
Thank you very much, Coises. It worked perfectly, saved my weekend! I applied the regex, using Linux Debian Sid, Notepad++ running via wine. Sorted out!
-
Sorry to bother you, but I have a question that I may need in the future. If I wanted to do the opposite, in the end result removing everything inside [] including [] itself, would it be possible? The end result would be this:
oooo m6cmp5
udd64j kkrt7 8d66sdjnd
maoerchgu 996d63542
oiudzzc3 -
@Emalino-Emalero said in How to find the first space in all lines?:
Sorry to bother you, but I have a question that I may need in the future. If I wanted to do the opposite, in the end result removing everything inside [] including [] itself, would it be possible? The end result would be this:
Find what :
^(\S++)\h
Replace with : (empty) -
Thanks!