in reply to Re^2: returning matched word from string
in thread returning matched word from string

Oh, I see. You are simply comparing the two strings. I am positive there is a more efficient way to do this, but for a makeshift fix you could put each word of $teststring into an array. Then, foreach element, test to see if it matches $line in the aforementioned array.

<(^.^-<) <(-^.^<) <(-^.^-)> (>^.^-)> (>-^.^)>