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; /i stands for ignore case in the given string. Usually referred to as case-insensitive as pointed out in the comment.
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.
[a|p]matchesa,|orp(yes, the|as well!). Inside a character set, the pipe has no special meaning. So you'll probably want to do:[ap]mwhich matchesamorpm.([1-9]|1[0-9])will only match'1','2','3', ... ,'19'. Is that correct?digits-digitsi.exxxx-xxi.e n digits n then-and then one or two digits, my regex will look like this?/^\d+-\d{1,2}$/or something else?