In Python 3.x code
import re
link = 'http://py4e-data.dr-chuck.net/known_by_Tamlah.html'
print(re.search('by_(.*).h', link).group())
print(re.findall('by_(.*).h', link))
I’m trying to find a name in the link.
Result of work.
by_Tamlah.h
[‘Tamlah’]
Regex the same, functions different. The question is why re.search() function doesn’t understand string extraction start, end regular expression ()? The correct result is Tamlah.
New contributor