Ken Ma - 2008-03-14

Hi this is my situation:

I want to extract certain infomation from a text file. Right now, I have the users define the containing elements (opening and closing) and it parses the stuff in the middle as a result.

For example:

testData = "Short Display: MON     Long Display: Montreal"

startTerm = "Short Display"
endTerm = "Long Display"

# So I want all the text inside the start and end terms which in this case is "MON"
# the grammer
searchTerm1 = startTerm + ":" + OneOrMore(Word(alphas)).setResultsName("value") + endTerm

for t,s,e in searchTerm1.scanString(testData):
     print t.value


this doesn't work! t.value is not showing anything. Is my grammer incorrect? Is there another way to do this? please help, thanks