Find absolute file/folder paths with the given ``re`` pattern.

    Args:
        * pattern: search pattern, support both string (exact match) and `re` pattern.
        * path: root path to start searching, default is current working directory.
        * recursive: whether to recursively find the matched items from `path`, False by default

    Returns:
        Generator of the matched items of Files/Folders.

def find(pattern, path=os.path.curdir, recursive=False):
    """
    Find absolute file/folder paths with the given ``re`` pattern.

    Args:
        * pattern: search pattern, support both string (exact match) and `re` pattern.
        * path: root path to start searching, default is current working directory.
        * recursive: whether to recursively find the matched items from `path`, False by default

    Returns:
        Generator of the matched items of Files/Folders.
    """
    root = realpath(path)

    Finder = lambda item: regex.is_regex(pattern) \
                    and pattern.match(item) or (pattern == item)

    if recursive:
        for base, dirs, files in os.walk(root, topdown=True):
            for segment in itertools.chain(filter(Finder, files), filter(Finder, dirs)):
                yield FS(os.path.join(base, segment))

    else:
        for segment in filter(Finder, os.listdir(root)):
            yield(os.path.join(root, segment))