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.

In my XML file there are lots of sub strings starting with STDSUP- and then three digits. For example: STDSUP-123. I would like to replace the STDSUP with CCDA. There are some sub strings where STUSUP- is following by non-numeric characters. I don't want to change them. So, I used STDSUP-\d\d\d in the find field and CCDA-\d\d\d in the replace with field. But the three digits are getting replaces with ddd. I want to replace only STDSUP and want the digits unchanged.

Any help?

share|improve this question

2 Answers 2

To keep part of the string intact, you want to use a group in your "find" expression and a backreference in your "replace" one.

Find: STDSUP-(\d\d\d)
Replace: CCDA-\1

screencap

share|improve this answer

Starting in Notepad++ version 6, you can also separate the match with PCRE-style capture groups:

Find What: (STDSUP-)(\d\d\d)

Replace with: CCDA-$2

share|improve this answer
    
-1: This does not work in Notepad++ - it replaces the digit string the OP wanted to preserve with $2. See this screencap. –  ncdownpat Jul 22 '13 at 19:05
1  
It works in Notepad++ starting in version 6. see: stackoverflow.com/a/11970406/1521193 –  ml9992 Jul 22 '13 at 19:12
    
Ah, my bad. I was still running the old version. Edited and undownvoted :) –  ncdownpat Jul 22 '13 at 19:18

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.