some_text = (
    """This text contains some profane words like spam and eggs. But it wont match spammy stuff."""
    )
print(some_text)
clean_text = pattern.sub('XXX', some_text)
print(clean_text)
Profanities in Django comments