To expand on what was said about parsing the text first instead of using $4, $5, and $6...

What determines where the text is located? Is there some word or character that lets you know? For example, let's say that you had these two inputs:

some words-more words-text
word-more words-text

If you wanted "text" each time, you can tell where it is not based on what word it is, but because there are 2 -'s before it. If you can find something specific that can be used to determine whether or not the text is at $4 or $5 or $6 before trying a match on it, your match will be much cleaner.

Invision Support
#Invision on