How to get the first two numbers of a string with python regex

I want to be able to get the first two numbers in a string and print the first two numbers, I want to do this using regex, this is currently my code:

import re
string = str(input("String: "))
product = re.findall('[a-z].*[a-z]', string)      

I would like an output like this for example:

 import re
 string = str(input("String: ")) //Air Max 90 or Air Max 987
 //Logic regex here
 Air max 90
 Air Max 98


To clarify, what I need is to display the string with the first two numbers and exclude all the rest of the number that exists.

I want to be able to display the numbers that are in the string, but only the first two, how can I do this?


You may use this regex:


RegEx Demo

By using (?:bd{2}(?=s*d)|$) after ^.*? we make sure to stop match when we get a word starting with 2 digits that must be followed by another digit after optional spaces or else match till the end.