title: How to replace regex string matches (one by one) in file2 by the same matches from the similar file1 in Python?
body: <p>I need to copy regex matches from one structured .txt file and paste it into another similar .txt file, so that the found regex matches from file_1 will replace the same matches in file_2, one by one, by file_1 matches?</p>
  
  <p>Example text files with the strings for replacement:</p>
  
  <pre><code>#TXT file 1:
  
  randomtext_randomtext_randomtext_randomtext_new_STRING_Arandomtext_
  randomtext_randomtext_new_STRING_Brandomtext_randomtext_randomtext_
  randomtext_randomtext_randomtext_randomtext_randomtext_randomtext_
  new_STRING_Crandomtext_randomtext_randomtext_randomtext_
  
  #TXT file 2 (the exact same structure, but a little different strings values):
  
  randomtext_randomtext_randomtext_randomtext_old_STRING_Arandomtext_
  randomtext_randomtext_old_STRING_Brandomtext_randomtext_randomtext
  _randomtext_randomtext_randomtext_randomtext_randomtext_randomtext_
  old_STRING_Crandomtext_randomtext_randomtext_randomtext_
  </code></pre>
  
  <p>How do I copy strings found by using regex: new_STRING_A, new_STRING_B and new_STRING_C from file_1.txt into file_2.txt in place for the same regex matches: old_STRING_A, old_STRING_B, old_STRING_C, so that the new strings from file_1 will replace old strings from file_2?</p>