Parsing makes my head hurt. Someone on the REBOL facebook page asked about finding a multi-word phrase in some text. I thought about that, looked again at the parsing documentation, found that I could not understand how to do it, and tried to formulate a question in the sample below. The problem seems to be finding a phrase of words when that string of characters is part of something bigger that is actually NOT that phrase.
Thank you.
R E B O L [
Title: "Demo to find if a word exists in some text"
]
TEXT-1: {
The village left armed men with firearms from the army
to defend the farm during warm weather.}
TEXT-2: {You left army life because you broke your left arm?}
FIND-PHRASE: func [
"Return true if PHRASE is in TEXT, otherwise return false"
TEXT
PHRASE
] [
????
]
FIND-PHRASE TEXT-1 "arm" ;; false
FIND-PHRASE TEXT-1 "left arm" ;; false
FIND-PHRASE TEXT-2 "arm" ;; true
FIND-PHRASE TEXT-2 "left arm" ;; true
halt