Regex /gi --> If /i is not needed, then is it benign to use it?

Just a clarification question.
I understand that /g is important for checking all possible forms of a given string. (Right??)
I’ve noticed that in some tests on the curriculum where /i is not relevant to the test (e.g. with /\d/ testing for presence of digits) that including \i does not affect whether I pass the lesson.
Now, does this mean that including ‘innocuous’ metacharacters (innocuous in terms of it does not interfere with fundamentals of the test being conducted) is harmless to the testing process (although unnecessary) OR are there scenarios where this will negatively impact the testing process?

Thanks for feedback!

Well, if I remember correctly, the i flag is just to make the reg. expression case insensitive. For digits and/or symbols it would have no effect, unlike if you’re using regex for password validation where case sensitivity matters, using the i flag would cause “baconbits” to be seen as a proper match for “baConbIts”.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.