'Python regex match male but not female [duplicate]

I'm trying to write a Python regex pattern to match anything with "male" but not "female" in it. A big issue for me is that the strings can look like this: "word_999male_word", so I can't just match "male" itself.

Here's my testfile I created so far:

import re

testlist = ['female', 'male',
            'female_word', 'male_word',
            'word_female', 'word_male',
            'word_female_word', 'word_male_word',
            'word_123female_word', 'word_999male_word']

# want to match everything that contains 'male' but not 'female'
for item in testlist:
    PATTERN = "male"
    PAT = re.compile(PATTERN)
    print(PAT.search, item)


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source