ignoreCase is a read-only boolean on a RegExp object. It is true when the pattern was created with the i flag — so letter matching ignores uppercase vs lowercase.
Remember
/hello/.test("HELLO") → false (case-sensitive)
/hello/i.test("HELLO") → true (ignoreCase)
/hello/.ignoreCase → false
/hello/i.ignoreCase → true
new RegExp("ok", "i").ignoreCase → true
// i affects letters — not digits or symbols
Add the i flag when you create the regex, then read .ignoreCase if you need to inspect it.
Write /pattern/i (or new RegExp("pattern", "i")).
Use test() or match() — letters match either case.
Read regex.ignoreCase to confirm the flag is set.
Combine with g as /pattern/gi when you need every match.
Piece
Required?
Role
Flag i
Yes (for ignore case)
Turns on case-insensitive letter matching
.ignoreCase
Read-only
true if i was set at creation
Flag g
Optional
Find every match (gi)
Pseudocode
Pseudocode
if regex has flag i:
ignoreCase = true
when matching letters:
treat "A" and "a" as the same
else:
ignoreCase = false
"A" and "a" are different
// digits and most symbols stay unchanged either way
Reference
Cheat Sheet
Keep these facts handy while writing case-insensitive patterns.
Topic
Detail
Property
regex.ignoreCase → true / false
Flag
i in /pat/i or new RegExp(pat, "i")
Default
Case-sensitive (ignoreCase === false)
With global
/pat/gi
Mutable?
No — create a new RegExp to change flags
Standard
Core regex (ES3+) — universal support
Try it
Live Preview
Compare /error/ vs /error/i on a sample string.
Browser demo of case-sensitive vs /i — same idea as the examples below.
No flag./ok/ is case-sensitive → ignoreCase is false.
Literal i./ok/i sets the property to true.
Constructor. Pass "i" as the second argument for the same effect.
flags string..flags lists active flags; here just "i".
Edge Cases & Pitfalls
Check these before relying on ignoreCase in real projects.
fixed
Flags cannot be changed later
ignoreCase is read-only. To switch modes, create a new RegExp with or without i.
scope
Letters, not everything
The i flag does not make digits or symbols “flexible.” /1/ and /1/i behave the same for numbers.
unicode
Unicode case folding can surprise
Most Latin letters work as expected. Some Unicode characters need the u flag and careful testing for full case folding.
intent
Do not always use i
Passwords, codes, and case-sensitive IDs should stay case-sensitive. Add i only when case truly does not matter.
Compatibility
Browser & Runtime Support
The i flag and RegExp.prototype.ignoreCase are core JavaScript regular-expression features (ES3+) and work everywhere.
✓ Baseline · ES3+
RegExp ignoreCase
Supported in all evergreen browsers, Internet Explorer, and every current Node.js / Deno / Bun release.
100%Universal support
Google ChromeAll versions · Desktop & Mobile
Full support
Mozilla FirefoxAll versions · Desktop & Mobile
Full support
Apple SafariAll versions · macOS & iOS
Full support
Microsoft EdgeAll versions · Chromium & Legacy
Full support
Internet ExplorerIE 4+ · Legacy environments
Full support
OperaAll modern versions
Full support
Samsung InternetSupported · Android
Full support
BunSupported · JavaScript runtime
Supported
DenoSupported · JavaScript runtime
Supported
Node.jsSupported · Server runtime
Supported
Android WebViewSupported · Modern WebView
Full support
ignoreCaseUniversal
Bottom line: Safe everywhere. Use /pattern/i for case-insensitive letters; read .ignoreCase to inspect the flag.
Analysis
Performance Notes
Approach
Cost
Best for
/pat/i.test(s)
O(n)
Quick case-insensitive check
s.match(/pat/gi)
O(n)
Collect every case variant
regex.ignoreCase
O(1)
Inspect the flag
The i flag adds negligible cost for typical patterns. Prefer test when you only need a yes/no answer.
Remember
Key Takeaways
Role:ignoreCase is true when the i flag is set.
Create: Use /pattern/i or new RegExp("pattern", "i").
Combine:/pattern/gi finds every match in any letter case.
Fixed: Flags are set at creation — build a new RegExp to change them.
One line:ignoreCase means the i flag is on — letters match without caring about upper vs lower case.
Frequently Asked Questions
A read-only boolean on a RegExp instance. It is true when the pattern was created with the i (ignoreCase) flag, so letter matching ignores uppercase vs lowercase differences.
Use a literal with i: /pattern/i, or the constructor: new RegExp("pattern", "i"). The ignoreCase property reflects that flag at creation time.
No. The i flag mainly affects letters. Digits, spaces, and punctuation match the same with or without i.
Yes. Use gi or ig: /error/gi matches ERROR, Error, and error everywhere in a string.
Similar for one letter, but ignoreCase applies to the whole pattern. /hello/i is simpler than /[Hh][Ee][Ll][Ll][Oo]/ and scales better for longer words.
No. Flags are fixed when the object is created. To toggle case sensitivity, build a new RegExp with or without i.