RipGrep

Glob

–glob parameter controls which files and directories are included or excluded from the search.

rg "pattern" --glob '!**/*.yaml'    # ! - exclude
                                    # **/ - matches any directory depth
                                    # *.yaml - any files ending with .yaml

Search for foo in in all files and subdirectories but legacy folder:

rg "foo" --glob '!legacy/**'        # !legacy - exclude "legacy" folder
                                    # ** - all files and subfolders