Sunday, October 27, 2019

Python program to retrieve all words staring with a numeric digit


import re
str = 'The meeting will be conducted 
on 1st and 21st of every month'
res = re.findall(r'\d[w]*' , str)
for word in res:
    print(word)

Output: 

1
2
1

No comments: