How do I put this regex in case insensitive?
var message_id = result.match(/Message-Id\:(.*)/)[1].replace(/^\s+/, '');
Thanks
By default, the comparison of an input string with any literal characters in a regular expression pattern is case-sensitive, white space in a regular expression pattern is interpreted as literal white-space characters, and capturing groups in a regular expression are named implicitly as well as explicitly.
Discussion. Currently, REGEXP is not case sensitive, either.
re. IGNORECASE : This flag allows for case-insensitive matching of the Regular Expression with the given string i.e. expressions like [A-Z] will match lowercase letters, too. Generally, It's passed as an optional argument to re.
With the i
flag:
/Message-Id\:(.*)/i
// ^
Documentation →
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With