import re


def _count_infix_segments(string: str) -> int:
    """Counts total number of infix segments, ignores @-strings."""
    if "[" not in string:
        return 0
    if "@" in string:
        return 0
    nosuffix = re.sub(r"\][^\]]*$", "]", string)
    noprefix = re.sub(r"^[^\[]*\[", "[", nosuffix)
    nobrackets = re.sub(r"\[[^\]]*\]", "", noprefix)
    return len(nobrackets)