Use indexAt to get the position of a character, or write a parser that looks for an entire word, then use substring to get a portion of the string.
Or if you already know the position of your text use:
teststring = "hello how are you today?";
middle = teststring.substr(6, teststring.length-1);
trace(middle);
Note that the 7th character is numbered 6, an array or string starts at 0, not at 1. That means the 2nd from the end is the total length of the string minus 1, not 2.
Actually, what this does is take the substring up to and including the 2nd character from the end. As I understand it, you actually want to remove the 2nd character from the end as well (the substring up to and including the 3rd character from the end). For this you would use “testString.length - 2”. Hope that made sense!
I`m not sure exactly what you are trying to do but i think there has been some confusion between substr() and substring()
try
teststring = “hello how are you today?”;
myvar = teststring.length-2;
middle = teststring.substring(6, myvar);
trace(middle);