def anyheader_filter(reader, header_match):
    """
    Filter dialogs by a regexp which must match any packet in the dialog.
    """
    for dialog in reader:
        for packet in dialog:
            if packet.search(header_match):
                yield dialog
                break
