Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Tried extended search --> replace with \0 but does not seem to work. Instead it deletes all occurrences of the char. Could it be a bug ?

NB : replacing with \n, \r\n and the like works in extended search

EDIT : notepad++ 6.4.1 Unicode

share|improve this question

5 Answers 5

Try \d### (where # is a single digit in the 0-9 range).

See Escape sequences supported in extended mode for more.

Edit: Looks like \d, \u, \x etc. don't work properly when it comes to replacing with the NUL character. Search works fine (I inserted a few NULs using a hex editor), but replace doesn't and simply deletes the characters.

share|improve this answer
    
sounds like bug report time then :) –  Mr_and_Mrs_D Jul 7 '13 at 23:37

Searches on the internet showed that inserting NUL in Notepad++ is non-trivial, for example see Insert a Null Character (ASCII 00) in Notepad

A hackish way to replace given character/characters with NUL is via the Hex Editor Plugin.

  1. Go to hex mode (via Plugins → HEX-Editor → View in HEX, or Ctrl+Alt+Shift+H)
  2. Highlight the character(s) you want to replace.
    • You can either highlight it in the "Dump" column or in the "0 | 1 | ... | f" column.
  3. Ctrl+H to bring up the Replace menu.
    • Change "Data type" to "Hexadecimal".
    • The character(s) you highlighted will show up under "Find what" (as a hex string)
    • Enter "00" in the "Replace with" field (that is a null byte)
  4. Press "Replace" or "Replace all".

Disclaimer: I've heard from somewhere that the Hex Editor plugin is buggy but I've only used it occasionally in the past (it worked alright but your mileage may vary) so I don't really know the extent of its bugginess.

You can install it via Notepad++'s Plugin Manager (Plugins → Plugin Manager → Show Plugin Manager) but you might need to check "Show unstable plugins" under Plugin Manager's "Settings" for the plugin to show up

share|improve this answer
    
I found this same plugin while searching, and uninstalled it after it crashed my NP++ twice. Instead I just used a good ol' hex editor instead. –  Karan Jul 7 '13 at 23:39
    
@Karan, it rarely crashed when I was using it. I should probably add a "YMMV" disclaimer to my answer. –  doubleDown Jul 7 '13 at 23:42
    
lol it hangs on ctrl+h - but yeah that's a step to the right direction - could you fill a bug report and post it here ? edit : I'd seen the question you ;inked to (I did search before asking but did not work anyway - and I need a replace not an insert) –  Mr_and_Mrs_D Jul 7 '13 at 23:42
    
@Mr_and_Mrs_D: If you're asking him to report bugs in the plugin, won't help. That plugin seems to have been been abandoned for the last 4 years or so. –  Karan Jul 7 '13 at 23:44
    
@Mr_and_Mrs_D: can't really reproduce that. Do you have a large file or something? How about you try Ctrl+F then click on "Replace" tab (i.e. try random stuff) –  doubleDown Jul 7 '13 at 23:45

As far as I know Notepad++ has always had issues with inserting 0-characters.
Notepad++ is no exception: Most editors can't deal properly with it.
It is not really surprising. Dealing with 0-characters is quite a niche application.

The only Windows editor that I am aware of that can handle 0's as any other character is UltraEdit.
(And it has an hex-edit mode as well, so one way or another you can get the job done with it.)

share|improve this answer

How to insert any byte value into a text:

  1. Npp -> Plugins -> Python Script -> New Script
  2. Select where to save ... and give the name insert a byte (say)
  3. in opened Npp doc insert this code:

        s= notepad.prompt('Enter value, or series, in a box, e.g.: \x5Cx00 ','Insert a byte ')
        exec("a=b'{}'".format(s))
        editor.addText(a)
    
  4. Save.

  5. Restart Npp

  6. Then you must see own script under menu:
    Npp -> Plugins -> Python Script -> Script -> insert a byte
  7. If you want shortcut for this, please see how to: Wrap Text with Quotation Marks in Notepad++
share|improve this answer
up vote 0 down vote accepted

Reported it as a bug here - please comment there in hope it's fixed - looks like a possible can of worms to me.

References :

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.