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.

I have a large xml file that I'm trying to replace text in and would like to replace sections of the test with other text. Below are example tags that I would like to modify. The section of each tag _ACK I wouuld like to replace with _HSK. The quantity of characters between the ] (right bracket) and the _ (underscrore) is different from each tag. I'm having trouble writing an expression in Notepad++ to perform this. Any help would be appreciated. I have over 2000 lines that need to be changed.

ack-tag="{[Hialeah_RO_Main]AI_VT_1202B.H_ACK}" ack-tag="{[Hialeah_RO_Main]AI_VT_1202B.HH_ACK}" ack-tag="{[Hialeah_RO_Main]AI_AIT_2021_FAIL_AL_ACK}"

Thanks, Shane

share|improve this question
    
Can’t you just do a simple find-and-replace of _ACK_HSK? If that’s not what you want, then edit the question to include the desired target strings in addition to the sample source strings. –  Synetech Aug 9 '12 at 18:36
    
no because I have several other locations where _ACK is being used throughtout the file that I do on want to replace. –  Shane Aug 9 '12 at 18:49
    
What’s the difference? How can you determine which ones should be replaced and which ones should not? Is it only ones starting with AI_…? Only ones with a closing-brace immediately after _ACK? Some other criteria? –  Synetech Aug 9 '12 at 19:06
    
By your example, I would use find and replace _ACK}"_HSK}". Is this what you want? This will only match the _ACK preceded with }". –  Zuul Aug 9 '12 at 19:30

1 Answer 1

Within notepad++ replace dialog.

Use Regular Expresssion

if there is additional correction required after the ] before the _ACK then switch (.*) $2 with another replacement requirement.

Search and replace

(\])(.*)_ACK(\}")

replace

$1$2_HSK$3
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.