import re


def find_tables_by_title(table_list,title_pattern):
  """Return a list of tables by matching the title.

  This method returns a list of table objects containing
  all the tables in the supplied list 'table_list' for
  which the regular expression 'title_pattern' matches
  the table title.

  If no pattern is given then a list with all the table
  objects will be returned.

  A list is always returned, so in cases where there
  are no matches an empty list is returned, and if there
  is just one match then a list with a single item is
  returned."""

  rtitle = re.compile(title_pattern)
  rtable_list=[]
  for table in table_list:
    if rtitle.match(table.title()): rtable_list.append(table)
  return rtable_list