import re str = 'one two three four five six seven 8 9 10'
result = re.findall(r'\b\w{5}\b' , str) print(result)
Ouptut:
['three', 'seven']
instead of using the findall() method,
if we use the search() method,
it will return the first occurrence of the result only.
No comments:
Post a Comment