Replace text
-
Hi Guys.
I have about 1000 files in a directory. I am looking to search through all of them as all of them will have the line below. However the text in between the. " " will be different. I am looking to replace what ever is in-between the " " with for example new.png
overlay0_overlay = “6-Pak (USA).png”
Can anyone help with the find a replace syntax to do that please.
Many thanks in advance.
-
Hi:
Please back-up your files and try the following S/R regex:
Search: overlay0_overlay = \K".+?" Replace: "new.png"
Hope this helps.
-
@astrosofista said in Replace text:
overlay0_overlay = \K".+?"
Thank you so much. Perfect and worked a treat.
-
@astrosofista said in Replace text:
overlay0_overlay = \K".+?"
Actually. Sorry. I thought this has worked but it seems to not change the text. Any other suggestions? thanks in advance.
-
@Craig-McFarlane said in Replace text:
eems to not change the text
It’s possible the quotes you supplied and shown in the post above may not be the actual ones in the text file. Suggest copy the ones from the file, replacing the ones in the regex (regular expression) you used.
Alternatively, copy the entire portion of one instance you want to replace, then change all the text between the quotes to the one in the regex. You will also need to add the \K portion as shown in the regex. Hopefully you understand my idea.
Terry
-
Maybe this is the problem. I have assumed that the files to be changed uses strings with regular quote marks, as in “”, instead of “curly quotes”, because quoted text get changed into smart quotes when being posted to this forum. Please check that the S/R regex and your data use the same kind of quotes.
If this advice does not resolve the problem, please post examples of the offending text.
-
Thanks mate. Apologies what you did give me originally did in fact work. I was looking at the wrong copy of the data.
-
Glad it worked. Thank you for report it back.