Replacing text between two words, using wildcards, possibly regex?
Hope someone can help. I've got a something such as:
var wtxt = GetComponent.<Text>();
var tstring = "<!DOCTYPE html><html><head><title>anypagetitle</title></head><body>there could be anything in here!</body></html>"; // for arguments sake. This is html source from any webpage
wtxt.text = tstring;
Which is all fine and good, the text appears in the guitext which the script is attached to.
However, what I'm looking to do is just keep the "there could be anything in here!" and discard everything else. So, remove whatever is before and after the body html tags (this changes and could be anything) as most website source has head, script tags and whatever else. Just keep whatever is between the body tags and store it in the tstring variable which I can work with.
I'm guessing I'd use regex in some way, but can't work it out. Even if I have to perform a trim up to the first body tag, then work backwards from the bottom of the string up until I find the end tag of the body The text between the body html tags will vary too, so this needs to be a wildcard somehow if done in one line piece of code.
If the string is too long, I also get the error:
"String too long for TextMeshGenerator. Cutting off characters."
This makes sense as I know Unity has a 6500 character limit, but once I have a solution to trim between words, this character limit will be drastically reduced. I'd like to do this all in unity, not by calling extra php from a server, and in unityscript / JS if possible. Any help is very very much appreciated. Many thanks.