Can someone explain str.extract(r'(\d+)')

So based on my quick google search:
str.extract(r’(\d+)’) --> \d, \D represents ANY ONE digit/non-digit character. Digits are [0-9]
+ represents one or more ( 1+ ), e.g., [0-9]+ matches one or more digits such as '123' , '000' .

So if d represents a digit or non-digit character? Why does it primarily pull out the digits from the “institute_service” columns

Eg: when the column value is “More than 20 years”, this function extracted 20 instead of the non-digit characters.

Also, what happened to NaN when I used this function? They just dissappeared from the updated columns once i parsed the column values through this funciton

r"(\d+)" searches through the text and ignores everything else apart from digit. When it finds one or more digits, it extract these digits only. I expect it to also only extract digits for a case like this 200c.

import re

pattern = r"(\d+)"

text = 'This regex trial 19'

digits = re.search(pattern, text)

Output
<_sre.SRE_Match object; span=(17, 19), match='19'>

import re

pattern = r"(\d+)"

text = 'This regex trial 20c'

digits = re.search(pattern, text)

<_sre.SRE_Match object; span=(17, 19), match='20'>