Hello, @asapRepsnp, @coises, @terry-r and All,
I think that an elegant solution would be to use the generic regex, exposed in this post :
Note that, to take in account the two types of your INPUT text, I used this leading regex part :
(?-is:^Message-ID:(?:|\R)\x20<.{4}
With the non-capturing alternative (?:|\R) which means : nothing or a line-break, between the colon char after Message-ID and the space char before the < character !
So :
Open your file in Notpead++
Move the caret ( cursor ) :
At the very beginning of your file ( Ctrl + Home )
On a line, or the first line, beginning with Message-ID
Open the Replace dialog ( Ctrl + H )
Uncheck the Wrap around box option
Then, with this complete regex S/R, below :
SEARCH (?-is:^Message-ID:(?:|\R)\x20<.{4}|(?!\A)\G).*?\K.(?=.*.{4}@)
REPLACE _
The INPUT example text, below :
Message-ID: <S3HC1075.C9B9D2W4@...> Message-ID: <F2CA98A6AWK-LDLL2WQVUFZWSA-8N4-O2WAX-DHGJ2@x> Message-ID: <20230112021536.D44C04F585AAECBA@...> Message-ID: <CAAGbbBVLx-B8sc2ifvzrHEUHTYEvSxkK5=OcDWxk=UKM3eMo2g@...> Message-ID: <347545688.95523.1695404577920.JavySail.boot@...> Message-ID: <S3HC1075.C9B9D2W4@...> Message-ID: <F2CA98A6AWK-LDLL2WQVUFZWSA-8N4-O2WAX-DHGJ2@x> Message-ID: <20230112021536.D44C04F585AAECBA@...> Message-ID: <CAAGbbBVLx-B8sc2ifvzrHEUHTYEvSxkK5=OcDWxk=UKM3eMo2g@...> Message-ID: <347545688.95523.1695404577920.JavySail.boot@...> Message-ID: <B7B207D39A1D4104860D8073A027CCD51DACD65B146E@...> Message-ID: <286f14f5-bb9d-4c26-ae24-2d4ae7484bb3@...>Is automatically changed as the following OUTPUT text :
Message-ID: <S3HC_________D2W4@...> Message-ID: <F2CA__________________________________HGJ2@x> Message-ID: <2023_______________________ECBA@...> Message-ID: <CAAG___________________________________________Mo2g@...> Message-ID: <3475___________________________________boot@...> Message-ID: <S3HC_________D2W4@...> Message-ID: <F2CA__________________________________HGJ2@x> Message-ID: <2023_______________________ECBA@...> Message-ID: <CAAG___________________________________________Mo2g@...> Message-ID: <3475___________________________________boot@...> Message-ID: <B7B2____________________________________146E@...> Message-ID: <286f____________________________4bb3@...>Using the free-spacing mode, with the leading (?x) modifier, your search regex would become :
SEARCH (?x) (?-is: ^ Message-ID : (?: | \R) \x20 < .{4} | (?! \A) \G) .*? \K . (?= .* .{4} @)
For identical replacements, of course !
Best Regards,
guy038