Regular Expressions 101

Community Patterns

Community Library Entry

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 - 2 years ago