Multiple search terms replaced with multiple terms

  • My first post in this forum!

    I am trying to replace six ANSI characters in a srt subtitles file with six Unicode characters, (Ã ã ª º Þ þ) with (Ă ă Ș ș Ț ț). Through Google I found this solution on

    Use regular expression Replace as follows:
    Find what: (Ã)|(ã)|(ª)|(º)|(Þ)|(þ)
    Replace with: (?1Ă)|(?2ă)|(?3Ș)|(?4ș)|(?5Ț)|(?6ț)

    It might have worked with previous versions of NPP, but with the latest version (7.2.2) on a Windows 10 64-bit machine, it does not.

    The following line for example:
    Aºteaptã, lasã-mã sã chem întãriri!
    Is replaced with:
    A|||?||teaptA|||||, lasA|||||-mA||||| sA||||| chem întA|||||riri!

    I’ll very much appreciate any RegEx help (not using a macro with multiple search and replace).

  • @Alan-Preda

    looks like you have to remove the | (pipe sign) from the replace.


  • @Claudia-Frank said:


    Thank you for your answer Claudia, but nope, your suggestion doesn’t work either!

    If I use the Replace button, the computer yells at me, if I use the Replace All, or Replace All in All Opened Documents, it does not yell, but nothing happens. The file remains unchanged.

  • @Alan-Preda



    Did I miss something?


  • Thanks again Claudia! It seems that you posted the same capture for both After and Before. Anyway, checking the Match case box (which I did not before), changes the results of the Replace All, like this:

    A?teaptA, lasA-mA sA chem întAriri!

    It should be like this:

    Așteaptă, lasă-mă să chem întăriri!

    I think the ? in A?teaptA means the ș Unicode character is unknown to NPP, while ã is replaced with A instead of ă.

    link text

  • @Alan-Preda said:

    It seems that you posted the same capture for both After and Before

    No, clearly the images are different. Please examine things carefully before replying.

    Also, “my computer yells at me” isn’t the type of error report that most people will even consider replying to. @Claudia-Frank, however, is saintly, and will most always try to reply with some help… :-)

  • Again thank you for responding! I’ve figured it out.

    Your suggestion to remove the pipes in the Replace With field was good. By itself it did not work. First convert the ANSI file to UTF-8, then apply the RegEx Replace without pipes in the Replace field, making sure the Match Case box is checked, was what made it work. Thank you anyway. Your suggestion helped.

    My eyes may not be as good as yours. I looked as both Before and After captures with the Windows Magnifier at 300%. I could not find any difference. I’m posting below a link to a screen capture of your post. Can you please help me discover the differences between the two pictures, by highlighting them in red?

    link text

    Thank you much!

  • @Scott-Summer

    “My computer yells at me” meant it emitted the error Windows sound. It did not cross my mind it will be so difficult to translate that into IT language (I am IT). My appologies!

  • @Alan-Preda

    No problem. Maybe it is me, but it absolutely didn’t cross my mind to equate “yells at me” to the “system error bell”. I use my PC with sound muted; maybe that’s why…

  • @Claudia Frank
    I realized why it worked for you by only removing the pipes in the Remove field, but it did not for me. You copied my example (Aºteaptã, lasã-mã să chem întãriri!) and pasted it into a new NPP document. By default, NPP is setup to make any new document into a UTF-8 document (to include correct representation of all characters, in all languages). In my case, as mentioned in my first message, I opened an ANSI file in NPP and applied the RegEx Replace strings to it. My file was an existing document, not a new document, so NPP did not automatically change it to UTF-8. I had to convert it first, from the Encoding menu, and then it worked. As I said, your original suggestion did help though, so I am grateful.

    @Scott Sumner said:
    No, clearly the images are different. Please examine things carefully before replying.

    I’ve also realized the phrase quoted above came from you, not Claudia. I’m still unable to find the differences between the Before and After pictures. I’ve posted a link to a screen capture of Claudia’s post with the two images. Maybe YOU can help me find what’s different between them, by highlighting it in red. Thank you in advance.

  • Hello, Alan,

    Indeed, the two Claudia’s pictures are different ! Just look, carefully, the line 3, six characters have changed, in the sentence, accordingly to your regex search/replacement :-))

    In the line 3, of the pictures, as expected :

    • Character º is changed into the character ș, at position 2

    • Character ã is changed into the character ă , at positions 8, 14, 17, 20 and 30

    Best regards,


  • @Alan-Preda

    sorry for being late, answered the question just before I went to work.
    As Scott and guy038 already said, the images are different.
    In regards to the problem you discovered, of course, it must be made sure that
    text which needs to be converted are in the expected format. As I was copying from html page
    it most likely was encoded in utf-8.
    But if you have a valid ANSI text and the replace chars are as well ANSI compatible, it should have been worked.


  • Wow! Thank you guy038!!!
    I was looking for changes in the Replace strings, while Claudia was pointing to the changes MADE by applying the RegEx Replace function (at the top of the image). That is, I was thinking Claudia posted the before and after to show me how to correct my replace strings, while she actually posted them to show me the Replace string without pipes does work!

    Many thanks again to both of you! You two guys are making a great support team on this forum!

  • @Scott-Sumner

    Hi Scott,

    thx for the kind words or … ?? ;-)
    I’ve asked what saintly means and it tells me that
    I’m either holy Mary or behave like a sheep. :-D

    I take the sheep if you don’t mind!


  • @Alan-Preda

    Many thanks again to both of you! You two guys are making a great support team on this forum!

    If I would have the same patience that guy038 has, I would have written a book ;-)
    about what I’ve done but as I’m lazy and just found out that my linux screenshot tool
    can upload images automatically I prefer this way because a picture says more the words.
    Well, mostly ;-)


  • @Claudia Frank
    Thank you Claudia for the added details to your initial answer. As I mentioned, you copying my example from the html page and pasting it into a new document in NPP made it work for you. Because of this default setting, shown in the capture found following the link below:

    link text

    Many thanks, again and again! :)

  • @Alan-Preda

    Alan, your welcome.
    You are right, this setting is set because I only work with utf-8 at all.
    Just to be sure, your question has been answered or is there something left?


Log in to reply