Reputation: 57
I want to delete all texts but keep texts that are 32 in length and contain a-fA-F0-9
How can I do it?
I'm using notepad++ btw
Upvotes: 0
Views: 141
Reputation: 56809
Search for:
^(?![a-FA-F0-9]{32}$).*
Replace with (leave blank). Leave .
matches new line unchecked.
Test input:
0234020ab023ba023ab0a283924892a5
klsjfs
3298472847298374982374928749827394873942
023abecedf86596783495a28392482a5
0234020ab023ba023ab0a283924892g5
The regex basically search for all lines that doesn't contain ^[a-FA-F0-9]{32}$
, which is what you want to keep.
The (?!...)
is zero-width negative look-ahead, which looks ahead in the text and allow the match to continue if the text ahead doesn't match the pattern inside. It doesn't consume text (zero-width), which means the match continue from where it were before it enter (?!...)
.
Upvotes: 2