Text File Manipulation

Hey,
I am searching for a possibility to search keywords in a text file and replace the text between this keywords.
Basically textfile:

... some text...
tag1originaltexttag2
...sometext

The idea is to search for tag1 and tag2 and substitute the text delimited by these.
E.g:
with applying a function like function[textfile,“tag1”,“tag2”,“newtext”]

... some text...
tag1newtexttag2
...sometext

I have tried several combinations of input output stream manipulations, Find, Position, etc.,
but didn’t find an appropriate solution.
Is there an easy function to accomplish this?
Thanks in advance

Can you adapt something like this?

fun[textfile_, tag1_, tag2_, newtext_] := (
   old = Import[textfile]; 
   new = StringReplace[old, RegularExpression[tag1<>".*"<>tag2]->tag1<>newtext<>tag2];
   Export[textfile, new]
   );
fun["textfile.txt", "tag1", "tag2", "newtext"];

You may need to insert the path to your textfile if it isn’t in a place that Mathematica knows to look.

A less elegant way. Click the pull down menu “Edit” select “Find” then type in the text you want to change.