import re


def get_query_length(record):
    """
    Get query sequence length.
    Example line:
    Query:       query  [M=2905]
    """
    match = re.search(r'Query:       query  \[M=(\d+)\]', record)
    return int(match.group(1)) if match else 0