Complicated search and replace
-
Hello, I have lots of texts that looks like this:
<array name=“mRomPawnEquipItemId” type=“s16” count=“11”>
<s16 value=“396”/>
<s16 value=“491”/>
<s16 value=“560”/>
</array><array name=“mRomPawnEquipItemId” type=“s16” count=“11”>
<s16 value=“667”/>
<s16 value=“971”/>
<s16 value=“860”/>
</array>And I would love to have them all converted to this:
<array name=“mRomPawnEquipItemId” type=“s16” count=“11”>
<s16 value=“111”/>
<s16 value=“111”/>
<s16 value=“111”/>
</array>Is there any way to have a search and replace look ONLY for a start and end line as a criteria for search and replace (since middle is never static), example:
<array name=“mRomPawnEquipItemId” type=“s16” count=“11”>
(IGNORE ANYTHING IN MIDDLE)
</array>Then do a replace based only on START: <array name=“mRomPawnEquipItemId” type=“s16” count=“11”> and END </array> to this:
<array name=“mRomPawnEquipItemId” type=“s16” count=“11”>
<s16 value=“111”/>
<s16 value=“111”/>
<s16 value=“111”/>
</array>All i want to do do is have lots different textblocks with similar start and end array to be changed to what my example show.
Can Notepad++ do this or any plugin or any other software? Any example on how to achive this would be amazing!
-
Hello @Nozomu-Ezomori,
this depends highly on the real file content. I assume, from the given example, that it is a xml file, correct?
If so, a script, written in a language which can handle xml documents, can easily do it as long as the xml node
has an unique identifier like the parent node, or its node name etc…
I assume it can also be done by using the mighty regular expressions if there is a pattern which can be identified.So, without having the real content, we can only give suggestions on how to solve it.
Cheers
Claudia
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login