According to this page from www.Regular-Expressions.info , case sensitivity and other similar flags / options are usually implemented in the programming language, and not directly in the template itself. However, if the language does not provide the ability to pass flags / options / flags, the RegEx page linked above indicates that parameters such as case insensitivity can be specified in the template.
To specify a pattern as case-insensitive, you can specify (?i) as the beginning of the case-insensitive part, and (?-i) as the end of the case-insensitive part.
In your specific situation, this means that the following RegEx pattern may be effective: \.(?i)(png|gif|jpg|jpeg|ico|bmp|svg|tiff)(?-i)$ Obviously, you will want to change this template to your needs to add or remove image file types.
In this template: \. indicates a literal period symbol ( . ); (?i) disables case sensitivity for all the following parts; (png|gif|jpg|jpeg|ico|bmp|svg|tiff) denotes a list of options, that is, the file extension must be one (and only one) of the options in the list; (?-i) includes case sensitivity; and $ denotes the end of the line, that is, there cannot be any characters following the file extension.
If the language you use supports specifying matching flags in another way, I would advise you to specify them in any way that the language recommends; however, according to the RegEx info page above, this is the right way to specify them in the template (which does not allow the case to be case insensitive if you decide to add more to the template).
EDIT : As a warning, it seems that Javascript does not support turning on or off case sensitivity inside the template itself (using (?i) and (?-i) ). So, if you are working with Javascript, you will have to get around this by setting /i as the flag at the end of your expression or using a template such as: \.([pP][nN][gG]|[jJ][pP][eE]?[gG]|[gG][iI][fF]|[iI][cC][oO]|[tT][iI][fF]{1,2})$ . In this template, each letter in the extension is indicated in both upper and lower case. This allows the template to match the file extension regardless of the case in which it is written, but the rest of the expression is case sensitive.
source share