Regex Case Insensitive Match – Use the JavaScript i Flag

Local only

Fix a valid regex that returns No match only because the input uses different letter case.

8 chars · 1 line

8 chars · 1 line

Pattern did not match the inputFlags: g

Regex flag behavior

How to make a JavaScript regex case insensitive

JavaScript regular expressions are case-sensitive by default. The valid pattern vetatool therefore does not match VetaTool until the i flag is enabled. This tool is free to use. No account or payment is required.

Last updated

What you can do here

  • Valid regex behavior check
  • Case-sensitive comparison
  • JavaScript i flag
  • Match or No match output
  • Flag debugging
  • Browser-local processing

Steps

  1. Confirm that the pattern text itself is correct and the mismatch is only letter case.
  2. Add i once to the Flags field.
  3. Retest uppercase, lowercase, and mixed-case examples to confirm the broader behavior is intended.

The i flag changes comparison behavior, not the pattern text

Using i is usually clearer than manually writing uppercase and lowercase alternatives for every letter. Keep it off when case carries meaning in identifiers or codes.

Case-insensitive regex example

Keep the same pattern and add the ignore-case flag.

Pattern and flags

vetatool / no flags

Corrected flags

i

Common questions

Frequently asked questions

Is JavaScript regex case-sensitive by default?

Yes. Without i, uppercase and lowercase letters are compared case-sensitively.

Can I combine i with g or m?

Yes, as long as each supported flag appears at most once.

Should I always use i for user input?

Only when the requirement is truly case-insensitive. Some tokens, IDs, and codes intentionally distinguish case.

Debugging a specific Regex issue? Browse Regex troubleshooting.