Remove every other character

  • I’ve opened a corrupted jpg file in notepad++ and noticed that every character is doubled. For example, instead of going “ÿØÿà JFIF” at the start, it goes “ÿÿØØÿÿàà JJFFIIFF”. This goes on for the whole 2456 lines. I want to know if there’s a way to remove every other character to make it normal again as I’m pretty sure this is the root of the corruption.

  • Hello, @swag-potato and All,

    Weird request ! Anyway, @swag-potato, here is a solution :

    • Open the Replace dialog ( Ctrl + H )

      • SEARCH (\w)\1

      • REPLACE \1

      • Tick the Wrap around option

      • Select the Regular expression search mode

      • Click on the Replace All button

    Notes :

    • This regex change any doubled word character with this word char

    • If some non-word chars ( as :, # or ,… ) exist in your .jpg file, prefer the following search regex (?-s)(.)\1 !

    Best Regards


  • @Swag-Potato said in Remove every other character:

    I’ve opened a corrupted jpg file in notepad++

    Editing a non-text file in Notepad++ is probably a pretty good way to ensure corruption, not eliminate it. My advice: Don’t do this.

Log in to reply