import re


def force_clean_name(name):
    """Return a name free of SWAT text tags and leading/trailing whitespace."""
    while True:
        match = re.search(r'(\[[\\/]?[cub]\]|\[c=[^\[\]]*?\])', name, flags=re.I)
        if not match:
            break
        name = name.replace(match.group(1), '')
    return name.strip()