I\'ve been trying to create a regex which would ignore the casing.
This is the regex i am trying to use:
/^[A-Za-z0-9._+\\-\\\']+@+test.com$/;
Flags go at the end.
/regex/i
i
is for case-Insensitive (or ignore-case)
Simple and straightforward, use following regex expression.
(?i)^[A-Za-z0-9._\-\']+@test.com$
For anyone else who arrives here looking for this, if you've got code that is using the RegExp
constructor you can also do this by specifying flags as a second argument:
new RegExp(pattern[, flags])
https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/RegExp
For example:
var pattern = /^[A-Za-z0-9._+\-\']+@+test.com$/;
var regExp = new RegExp(pattern, "i");