Delete md5 using notepad

  • Hi

    I have a long document. Using notepad++ or regex, I want to delete all lines containing md5


    How can this be done?
    someone who can help me, please?

  • @rovitie

    Try this:

    Invoke Replace dialog (default key: ctrl+h)

    Find what zone: ^[a-f0-9]{32}(?-s):.*\R
    Replace with zone: make sure this is empty
    Search mode selection: Regular expression
    Action: Press Replace All button

    Here’s how it works:


    • [Assert position at the beginning of a line (at beginning of the string or after a line break character) (carriage return and line feed, form feed)][1 ] ^
    • [Match a single character present in the list below][2 ] [a-f0-9]{32}
      • [Exactly 32 times][3 ] {32}
      • [A character in the range between “a” and “f” (case sensitive)][2 ] a-f
      • [A character in the range between “0” and “9”][2 ] 0-9
    • [Use these options for the remainder of the regular expression][4 ] (?-s)
      • [(hyphen inverts the meaning of the letters that follow)][4 ] -
      • [Dot doesn’t match line breaks][4 ] s
    • [Match the colon character][5 ] :
    • [Match any single character that is NOT a line break character (line feed, carriage return, form feed)][6 ] .*
      • [Between zero and unlimited times, as many times as possible, giving back as needed (greedy)][7 ] *
    • [Match a line break (carriage return and line feed pair, sole line feed, sole carriage return, vertical tab, form feed)][8 ] \R

    Created with RegexBuddy

    [1 ]:
    [2 ]:
    [3 ]:
    [4 ]:
    [5 ]:
    [6 ]:
    [7 ]:
    [8 ]:

    RegexBuddy settings to emulate N++ regex engine: Application=boost::regex 1.54-1.57 / flavor=Default flavor / replacement flavor=All flavor / ^$ match at line breaks / Numbered capture / Allow zero-length matches

  • @rovitie said:


    thanks you very much, sorry friend, but in some lines:
    ftp: a10a057d9aaea35231ca57d8959cc182
    test: 53c80014d7714fd6050257050fe4bb7e
    ftp: 887a100f39384fdb3d950ba1b55acba2: router
    the regex does not work
    I hope you help me, thanks you

  • <@cipher-1024 cooks popcorn and prepares for @Scott-Sumner to respond to the “new” information.>

    @rovitie, read up on regular expressions when you have time they’re a great tool to have. Also when you post examples, try and post different kinds. Posting some examples of what you tried and how it failed is good too. It shows you’re putting in some effort.

    Personally I would try
    That’s a bit like using a great big hammer (I do love the .* metacharacter combo!), where Scott’s was more like a scalpel, but this may work for you.

    Good Luck!

  • @rovitie

    The moral of the (sad) story is that if you don’t post representative data when you ask for help…or data that shows a pattern but (a) not the right pattern or (b) a misleading pattern…don’t be surprised if the help you receive does not solve your problem. @cipher-1024 has the best answer for you, paraphrasing: “read up on regex and solve your own problem”.

  • Hi, @rovitie, @scott-sumner, @cipher-1024 and All,

    Two other solutions :

    • Search > Replace... option

    • SEARCH (?-s)^.*[[:xdigit:]]{32}.*\R



    • Search > Mark... option

    • Tick the Bookmark line option

    • SEARCH [[:xdigit:]]{32}

    • Search > Bookmark > Remove Bookmark Lines



  • @guy038

    So sad that nothing was said about getting the problem statement right in the first place… :(

    I guess I don’t understand the utility of [:xdigit:] here when (a) it is tough to remember, and (b) [a-f0-9] is shorter. Is “xdigit” supposed to be faster for the regex engine to process? Okay, so I’m ignoring case here, but the OP’s examples were all in lowercase–but maybe we can’t trust the OP… :-)

  • Hi @scott-sumner, and All,

    I was a bit lazy to develop any idea, in that topic, as, since beginning of day, I was doing tests relative to the problem of the Word wrap feature, with very large files, discussed here :

    Now, Scott, regarding our problem, I did some tests ( again! )

    I created a .txt file, containing 100,000 MD5 strings and here are the results :

    • SEARCH (?i-s)^.*[0-9A-Z]{32}.*\R REPLACE Leave Empty => 100,000 lines deleted in 45 seconds

    • SEARCH (?-s)^.*[[:xdigit:]]{32}.*\R REPLACE Leave Empty => 100,000 lines deleted in 39 seconds

    • BOOKMARK [[:xdigit:]]{32} + Remove Bookmarked Lines => 100,000 lines deleted in 32 seconds ( 7s + 25s )

    Interesting, isn’t it ?

    This means that :

    • With a very large files and/or with numerous zones to delete, the combination of the Marking String and the Delete Bookmarked features is the best choice ;-))

    • The [[:xdigit:]] regex syntax seems a bit faster than the (?i)[0-9A-Z] syntax

    Best Regards,


  • A thousand apologies, I am not an expert in programming, a simple assistant of a company, excuse me Mr. Scott Sumner and cipher-1024, thanks for the help shown.
    guy038, the regex helped me a lot [[: xdigit:]] {32}, thank you very much

  • @rovitie

    Certainly no apology of any kind needed. It is tough to know what you don’t know. Good that it is working for you. I guess I was a bit harsh so I certainly apologize for that. Of course, I’m probably known for being somewhat harsh. ;-)

Log in to reply