Jul-25-2022, 12:26 AM
Not too sure what you want to do now, maybe this??
import re mylist = [15, '15', '1the', '5one', '5529care', '30over', '55more66', 25, '25'] pattern1 = re.compile(r'\D+') # matches non-numbers # re.findall returns a list for s in mylist: match = re.search(pattern1, str(s)) if match: result = re.findall('[0-9]+', s) print(s) print(result)