How to make regex case-insensitive?

后端 未结 1 1522
夕颜
夕颜 2020-12-11 02:55

I have this javascript code but when i send this: asd.JPG the regex fails to me..

if (data.match(/([^\\/\\\\]+)\\.(jpg|jpeg|gif|png|tiff|tif)$/i))
     retur         


        
相关标签:
1条回答
  • 2020-12-11 03:57

    The i flag you have on the end (/.../i) should be doing it.

    (CW because let's face it, one shouldn't earn rep for this sort of thing... :-) )

    0 讨论(0)
提交回复
热议问题