Hey guys, I haven’t been able to find a good answer for what I’m trying to do:
I have a large string that can contain anywhere from 6-18 lines of text. What I want to do is replace a single line in that larger string; sometimes the line I want to replace will appear in the larger string more than once, and it will typically never be in the same position (ie. it won’t always be the first line in the larger string or second line, ect.). Otherwise I want to keep the larger string intact, just have that one line of text removed from it, I iterate over this in my bot.
I’ve tried using regex but if there are duplicates this will remove multiple lines, I’ve also tried splitting before and after the line of text but again if there are duplicates this seems to return a blank value when splitting. Is there any easy way to tell regex or any replace function to only replace a single or first instance? Or use substring/ joins to do this?