I have a string variable containing
string = "123hello456world789"
Line
contains no spaces. I want to write a regular expression that prints only words containing (az) I tried a simple regular expression
pat = "([az]+){1,}" match = re.search(r""+pat,word,re.DEBUG)
the match object contains only the word Hello , and the word World does not match.
When re.findall() , I could get both Hello and World .
My question is: why can't we do this with re.search() ?
How to do this with re.search() ?
source share