JavaScript
Regex with optional ending character

by Benny Neugebauer

/\.ts(x?)$/.test('index.ts')
/\.ts(x?)$/.test('index.tsx')

/\.tsx?$/.test('index.ts')
/\.tsx?$/.test('index.tsx')