Regular Expressions 101

Community Patterns

1...45678...886

Match typescript filenames excluding .d.ts files

1

Regular Expression
ECMAScript (JavaScript)

/
(?<!\.d)\.(?<ext>[cm]?ts|tsx)$
/
gm

Description

Match typescript filenames excluding .d.ts files

This RegExp matches,

  • ts
  • tsx
  • cts
  • mts

But exludes typescript declaration file with .d.ts extension.

Submitted by @yumyum-web - a year ago