finding text before this and after that

How would I write an AppleScript that looked at the text “foobar, feeble, fazoo, fazle, feebar” and returned all the words between foobar and fazle, so that it returned “feeble, fazoo”?

Is this what you mean? I took out the commas in the original and used text item delimiters.

set mytext to "fubr foobar feeble fazoo fazle feebar"
set {TID, text item delimiters} to {text item delimiters, "foobar"}
set splitTxt to last text item of mytext
set text item delimiters to "fazle"
set midText to first text item of splitTxt
set text item delimiters to TID

words of midText --> {"feeble", "fazoo"}

[edit] Mind you, in this simple form, it won’t deal with duplicates and doesn’t check that the first is before the second, either.

If you wanted to return a text run intact, you could also do something like this with text item delimiters. (Again, duplicate words aren’t catered for - although the search words could be reversed.)

on textRun from t between {w1, w2}
	if not (w1 is in t and w2 is in t) then return ""
	set tid to text item delimiters
	set text item delimiters to w1
	set w1 to count words of t's text item 1
	set text item delimiters to w2
	set w2 to count words of t's text item 1
	set text item delimiters to tid
	if w1 > w2 then return t's text from word (w2 + 2) to word w1
	t's text from word (w1 + 2) to word w2
end textRun

textRun from "foobar, feeble, fazoo, fazle, feebar" between {"foobar", "fazle"}
--> "feeble, fazoo"

Then again, a simple repeat loop is also a possibility:

on textRun from t between l
	tell {} to repeat with i from 1 to count t's words
		if t's word i is in l then
			if (count) is 1 then return t's text from word (it + 1) to word (i - 1)
			set end to i
		end if
	end repeat
	""
end textRun

textRun from "foobar, feeble, fazoo, fazle, feebar" between {"foobar", "fazle"}
--> "feeble, fazoo"