Some Java Guy
Some Java Guy

Reputation: 5118

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

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;

Upvotes: 51

Views: 34483

Answers (2)

KooiInc
KooiInc

Reputation: 122946

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.

Upvotes: 9

Sachin Shanbhag
Sachin Shanbhag

Reputation: 55499

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

Upvotes: 88

Related Questions