from typing import Iterable
from typing import List
import re


def filter_filenames(filenames: Iterable[str], pattern: str) -> List[str]:
    """Filters filenames according to a regex pattern."""
    filtered_filenames = []
    for filename in filenames:
        if re.search(pattern, filename):
            filtered_filenames.append(filename)
    return filtered_filenames