Bulk editing in Notepad ++ program?



  • I am doing XML edits in the software, but I want to edit certain patterns collectively.

    For example: As in the picture in this alt text link, I want to change the transcripts of 2 or more patterns at once in many open documents.



  • @darkenb ,

    From the high level, you can apply the same search/replace patterns to multiple files at once, using the Search > Find in Files dialog in regular-expression mode.

    If you want more help than that, please follow the advice below, and give us more to be able to help you. Especially important in your case is providing text (marked as plaintext using the </> button) so we can see example data before and after the change. (We’ll probably just use one-file examples, but the same expression should work in multiple files, if the example data you give us is representative enough.)

    ----

    Do you want regex search/replace help? Then please be patient and polite, show some effort, and be willing to learn; answer questions and requests for clarification that are made of you. All example text should be marked as plain text using the </> toolbar button or manual Markdown syntax. Screenshots can be pasted from the clipbpard to your post using Ctrl+V to show graphical items, but any text should be included as literal text in your post so we can easily copy/paste your data. Show the data you have and the text you want to get from that data; include examples of things that should match and be transformed, and things that don’t match and should be left alone; show edge cases and make sure you examples are as varied as your real data. Show the regex you already tried, and why you thought it should work; tell us what’s wrong with what you do get… Read the official NPP Searching / Regex docs and the forum’s Regular Expression FAQ. If you follow these guidelines, you’re much more likely to get helpful replies that solve your problem in the shortest number of tries.



  • Is it possible to explain with an example? what I want is exactly in the picture below. Each document has category tags with different inputs, and I want to translate these tags into one entry at a time. Sorry, what you wrote was a bit complicated.

    Screenshot_1.png



  • @darkenb ,

    I asked for text, you gave an image. I asked for “before” and “after” data separately; you put the “before” and “after” in the same screenshot – and even on second reading, I didn’t realize that the to in your image was the change from X to Y indicator rather than part of your text.

    The rest of what I wrote is to help you learn and to help you get better help. The help you receive will only be as good as the effort you put into asking for help.

    For your actual problem:

    • FIND = <category>TEXT (\d)</category>
    • REPLACE = <category>TEXT $1$1</category>
    • Search Mode = regular expression

    (untested)

    I recommend you backup any files you try this on, and only try it on one file until everything is working.

    There are obvious assumptions in my example – that your text is literally TEXT every time, and that you’ll always only have one digit after text before </category> – but if my answer is not sufficient for your needs, you are going to have to do a better job of providing data that represents your data, and showing a willingness to learn.


Log in to reply