0

I'm writing piece of code detecting file extensions and I was getting quite a lot of garbage like . Jones - Some Document Title just because file name was starting with Dr. Jones. So I decided to put some additional filters like isalnum(c) to filter out only strings that contain alphanum characters but I'm still getting names like .65aab294d987659953343e8da131b2091c0c81c8 because some filenames happen to end with sha1 checksum.

So what are the longest extension names used in actual applications? I know DOS used to have 3 characters extension names but it's long gone since a lot of modern applications actually use 4 letters extensions namely jpeg, .mpeg, .webm, docx and so on so I'm rather asking about real world experience. Has anyone ever seen real extension longer than lets say 16 characters?

Lapsio
  • 760
  • 11
  • 25
  • The filename limit is 255 characters, but could be 253.1 or 1.253 – spikey_richie Nov 05 '20 at 15:48
  • this seems a little like tilting at windmills, but my main piece of advice is to start at the end of the string and work toward the beginning of the string. If there is a dot, then the extension is likely the first one you find. The list of known extensions is vast. Explode (or split) on the `.` and grab the last array element. – Yorik Nov 05 '20 at 15:49

0 Answers0