Tu pattern in Regex



Problem to find the "tu" started word in the given string.



Example-1:


Input    : s = "tutorial tour tennis time tuition turn"
Output   : ['tutorial', 'tuition', 'turn']   


Example-2:


Input    : s = "football tennis cricket tutorial"
Output   : ['tutorial']  







Solution





import re 

s = "tutorial tour tennis time tuition turn"

r = re.findall(r"[t]{1}[u]{1}[a-zA-Z]+",s)

print(r)



Output



['tutorial', 'tuition', 'turn']