Below is a part of my program which allows me to search for a word in a given text. However I would like to search for multiple words, or even be able to enter a sentence instead of just a word.

Thank you for any help you can provide.

def word_search():
    word = raw_input("Enter the word to search> ")
    for subtext in data:
        if re.search(r"\b%s\b" % word, subtext, re.I):
            print "FOUND", subtext

well I'm not so sure that regex would be necessary for this if it's just a couple words.

def find_these_words(text):
	if 'I' in text:
		print('found I')
	if 'love' in text:
		print('found love')
>>> t=input('Text>>> ')
Text>>> Ilovepython
>>> find_these_words(t)
found I
found love
>>>t=input('Text>>> ')
Text>>>I love daniweb
>>>find_these_words(t)
found I
found love
>>>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.