def _get_ltag_pattern():
    """
    Build the big ugly fat regexp for L# numbering. It's based on named
    patterns : (P?<pattern_name>pattern) and decomposed part by part.

    Please have a look on
    https://forum.camptocamp.org/t/question-l/207148/69
    """
    p = '(?P<{}>{})'.format
    raw_label = '[a-zA-Z\'\\"][a-zA-Z\'\\"\\d_]*|_'
    raw_offset = '[+\\-]?\\d*'
    multi_pitch_label = p('multi_pitch_label', raw_label)
    first_offset = p('first_offset', raw_offset)
    last_offset = p('last_offset', raw_offset)
    first_pitch = p('first_pitch', first_offset + multi_pitch_label + '?')
    last_pitch = p('last_pitch', last_offset)
    multi_pitch = p('multi_pitch', first_pitch + '?-' + last_pitch)
    mono_pitch_label = p('mono_pitch_label', raw_label)
    mono_pitch_value = p('mono_pitch_value', '\\+?\\d*')
    mono_pitch = p('mono_pitch', mono_pitch_value + mono_pitch_label + '?')
    local_ref = p('local_ref', '!')
    pitch = '(' + multi_pitch + '|' + mono_pitch + ')'
    numbering = p('numbering', pitch + local_ref + '?')
    text_in_the_middle = p('text_in_the_middle', '~')
    header = p('header', '=')
    typ = p('type', '^[LR]')
    text = '(' + header + '|' + text_in_the_middle + '|' + numbering + ')'
    return p('ltag', typ + '#' + text)
