Please write your code so people can read it better.
That won't work because it looks like will check the lines like this (red = char being checked)
xxxxxx
xxxxxx
xxxxxx
What I think you'll have to do is have a loop for each line, and go though all the chars. (note: this may get laggy)
Or use strPos (I think, im a little rusty on my string functions) in some way.
It would be much easier if you just made it stop at a line the says "<END>", if it would work for what your doing.