from typing import Iterable
from typing import List
import re


def _findAllByExtensions(self, extensions: Iterable[str], caseSensitive=False) -> List[str]:
    """Finds all files with one of the given ``extensions``.

    All extensions will be prefixed with a . before searching if one is not already present.

    Args:
        extensions (Iterable[str]): The list of extensions to search for
        caseSensitive (bool): Whether extensions should be treated as case sensitive

    Returns:
        List[str]: List of paths found with one of the given ``extensions``
    """
    extensions = [ext[1:] if ext.startswith('.') else ext for ext in extensions if len(ext) > 0]
    patternStr = f'.*\\.(?:{"|".join(extensions)})$'
    pattern = re.compile(patternStr) if caseSensitive else re.compile(patternStr, re.IGNORECASE)
    return self.findAll(pattern)