I'm trying to find and replace a string from a text file where the first part is constant, then the second part of it could be anything, then the last part is a constant. I want to change some of the 'last part' text, keeping the first part + the second part (which could be anything) remain the same. I hope the highly simplified example below illustrates what I mean:
Input text:
This is constant Line 1
*This is anything Line 2*
This is constant again and will change, Line 3
Output result:
This is constant Line 1
This is anything Line 2
This Line 3 has now changed
Does anyone know how this could be accomplished? The files being fed in have hundreds of occurrences of the last part so the first part + second part (though this could be anything, a wildcard perhaps?) + last part search should ensure only one result.
I hope this makes sense and thanks in advance!