In my python script, I have a list of strings like,
birth_year = ["my birth year is *","i born in *","i was born in *"]
I want to compare one input sentence with the above list and need a birth year as output.
The input sentence is like:
Example1: My birth year is 1994.
Example2: I born in 1995
The output will be:
Example1: 1994
Example2: 1995
I applied many approaches by using regex. But I didn't find a perfect solution for the same.
re.findall(r'(\d+)',val)[0]