def get_topics_by_pattern(client, pattern):
    """

    :param client: InfluxDB client connected in historian_setup method.
    :param pattern: topic_patterns to get matches. Should be a regex pattern
    :return: a list of dictionaries in format:

    .. code-block:: python

            [
                {topic1: topic_id1},
                {topic2: topic_id2},
                ...
            ]

    """
    topics_id_list = []
    query = 'SELECT topic, topic_id FROM meta WHERE topic =~ /%s/' % pattern
    rs = client.query(query)
    rs = list(rs.get_points())

    for point in rs:
        topics_id_list.append({point["topic"]: point["topic_id"]})

    return topics_id_list