I want to match a pattern like '2 years', '4 days' in a text, and meanwhile want to avoid a pattern like '2 years old', i.e., I don't want a 'old' following 'years'. I thought a negative lookahead (?!old) would help. But I don't know how to do it. I tried
r=regex.compile(r'\b(\d+)\s*(years?|months?|days?)\s*(?!old)\b')
but it still match '2 years'.