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.

How to find and replace in Notepad++ multiple different characters to corresponding letters at once throughout the text? For example, I have 32 characters that I want to replace. So I have the character like “À”, and I want to replace it with the letter “A”. Next, I have the character like “Æ” and I want to replace it with the letter “Ж” and so on. Generally, I have 32 such characters and each time I need to do the same operation. Is any way to do this at once?

Image demonstrating request

share|improve this question

3 Answers 3

Sometimes I have used wReplace from sharktime.com. It works pretty well. You install it and then can indicate as many characters to change as you want to.

I know it isn't a plugin style solution, but it works. Hope this helps!

It is very simple to use. This is a before/after image

share|improve this answer
1  
always good to mention the name of the program in the post so that they don't have to hover their mouse over the link to see what program you mean. –  barlop Jun 16 '12 at 15:49
    
thanks for pointing that out :) –  Soph Jun 16 '12 at 18:48

This previous question provides an answer. Short version is, within Notepad++ with no plugins, it's not possible due to the way Find and Replace works.

I'd look at using sed or similar.

share|improve this answer

Even with Notepad++ 6's new RegEx engine that supports PCRE (source), there's no sane (i.e., with linear complexity) and reliable (i.e., guaranteed to work) approach that will allow you do achieve this in a single Find & Replace, let alone a single Find in Files.

You can, however, achieve this by using Find in Files twice:

  1. Add a substitution matrix to each occurrence of any of the old characters:

    Find what:    ([ÌÍÎÏÐÑ])
    Replace with: ``\1`ÌH`ÍO`ÎΠ`ÏP`ÐC`ÑT``
    Search Mode:  Regular Expression
    

    This transforms fooÌbar into foo``Ì`ÌH`ÍO`ÎΠ`ÏP`ÐC`ÑT``bar, for example.

  2. Replace each old character (and the substitution matrix) with the corresponding new character:

    Find what:    ``(.).*?`\1(.).*?``
    Replace with: \2
    Search Mode:  Regular Expression
    

    This transforms foo``Ì`ÌH`ÍO`ÎΠ`ÏP`ÐC`ÑT``bar into H, for example.

Note that you need to upgrade to Notepad++ 6.0 or higher for this. While the regular expression itself should also work with the old RegEx engine, there's a bug messes up multibyte characters in general.

How it works

    • The character set ([ÌÍÎÏÐÑ]) matches any of those five characters.

      The parentheses turn this into the first subexpression (see next item).

    • \1 symbolizes the match of the first subexpression, i.e., the character we want to replace.

    • All other characters are treated literally.

    • The choice of ` as the delimiter is arbitrary. You can use any other character you want.

    • (.) matches the first character after ``.

      The parentheses turn this into the first subexpression.

    • .*? matches as few characters as possible.

    • `\1 symbolizes ` followed by the match of the first subexpression, i.e., the character we want to replace.

    • (.) matches the first character after the character we want to replace. By our design, this is its replacement character.

      The parentheses turn this into the second subexpression.

    • .*?`` matches as few characters as possible until the final `` is encountered.

For further information on regular expressions, consult:

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.