find ".ts" but not ".d.ts"

I don't believe egrep supports that syntax (your expression is a Perl compatible regular expression). But you don't need to use regular expressions in your example, just have multiple -name tests and apply a ! negation as appropriate:

find src -type f -name '*.ts' ! -name '*.d.ts'

You can get the result you want by filtering on file names only, negating the test for files you don’t want:

find src -type f -name \*.ts ! -name \*.d.ts

A simple (maybe less efficient) approach can be filter out the don't-want string.

find -name "*.ts" | egrep -v "\.d\.ts$"

Tags:

Find