regex question

hi all,

Been trying for 2 hours to find the regex to replace a portion of a string. In my string, I have # Start and # End. I need a regex that would capture # Start including what precedes it, another capture for # End and all that follows it, and insert a new string inside of that.

Example:

line of text

line of text

Start

End

line of text

 

would become

line of text

line of text

Start

Inserted text

could be multi-line

End

line of text

 

Thank you very much!

Daniel
When you post code, error messages, sample data or console output format it as code, please.
In the “Text” view you can use the code tags “PRE”, in the “Visual” view you can use the format template “Preformatted”. You can go back edit your post and fix the formatting - you don’t have to create a new one.
Thanks in advance.

This forum is for scripting questions rather than script requests. We do not write customized and ready to use scripts or solutions on request.

What have you tried so far? We expect you to make an own attempt to get your task done or to solve your problem. If you have done so already please document here what exactly you have done and show your code. Then we probably might be able to help you step further.

Have you tried to search for a solution first? Questions like this have been asked and answered already even here in this forum.

got it for the code format.

i tried many variations of a regex but haven’t been able to make it work yet.

but i managed to read the content and parse each line to a foreach loop taht did what i’m looking for.

thanks!

Sorry but No, you did not!

Please show your code!