What does /i at the end of a regex mean?

匆匆过客 提交于 2019-12-18 14:16:14

问题


What is the meaning of /i at the tail of this regex?

var time = /^([1-9]|1[0-9]):([0-5][0-9])(\s[a|p]m)$/i;

回答1:


/i stands for ignore case in the given string. Usually referred to as case-insensitive as pointed out in the comment.




回答2:


It's, like Sachin Shanbhag already answered the 'ignore case' modifier. So /[a-z]/i is equal to /[a-zA-Z]/. Check this link for other modifiers.



来源:https://stackoverflow.com/questions/4967369/what-does-i-at-the-end-of-a-regex-mean

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!