Given the {3} quantifier in the expression, the current fileext function matches only three letters following the period, so it can extract the jpg file extension, but it can't extract the extension when jpeg is used:
Therefore, when load.image for example checks to see if the output of fileext is png, jpg, jpeg, or bmp, it will raise an error for jpeg extensions, even though they are supported.
I modified it to match three or four characters after the period, so it will work on jpeg extensions as well. I tested the solution, and it matched only those expressions with 3-4 characters:
Given the {3} quantifier in the expression, the current fileext function matches only three letters following the period, so it can extract the jpg file extension, but it can't extract the extension when jpeg is used:
Therefore, when load.image for example checks to see if the output of fileext is png, jpg, jpeg, or bmp, it will raise an error for jpeg extensions, even though they are supported.
I modified it to match three or four characters after the period, so it will work on jpeg extensions as well. I tested the solution, and it matched only those expressions with 3-4 characters: