I'm having a pattern where it should be matched any where in the input text given
text_pattrn = """ Todays weather | Todays weather is | weather | Todays weather condition | weather condition """
input_text = """ Every one is eagerly waiting for the final match to be happened in this ground and all eyes on sky as todays weather condition is cloudy and rain may affect the game play"""
match = re.search(text_pattrn,input_text)
There are several text patterns repeated, for example "weather" is redundant because "Todays weather" already matches "weather" . Any solution to optimize the code would really helps a lot.
whether? That word is common to all the patterns, so you can just check for that, unless you need to use the matched text for something else later. (Also, note that the correct spelling for your example sentence is "weather", not "whether".)