changed way of matching tables to use regular expression