json – Regex Multiline Select and Replace Question

I have a list such as this:

“text1”

“text2”

“text3”

“text4”

“text5”

Where … is several thousand lines of other text. I want to go through the entire file and select all the “textn” and replace them all with

“AdditionalText1

text1″

“AdditionalText2

text2″

Throughout the entire file.
To start I’ve got both AdditionalTextn and textn set up in a google speadsheet aligned with eachother in column A and column B. I’m hoping to create a regex expression using a google spreadsheet formula that I will be able to use to generate the changes throughout the whole file without having to manually replace them all one at a time. I could do it in the spreadsheet itself however I need the lines to be in their original positions in an external file that is already generated (its a .json file of data).

I have the .json file loaded into Atom as the text editor, and i’ve been using Atom’s find and replace regex for many tasks up to now of this type, but this one is slightly more advanced as its multiline and each match is different on the lines and need to be replaced with a unique piece for each one.

So that’s what i’ve come up with so far, right now i’m just perusing random regex tutorials on multiline selections and replacements to piece together the knowledge, but I thought i’d bring it up here to see if anyone has some pointers. I’m happy to give more information as needed.

Read more here: Source link