DELAPARRA
Index
Color
NL
Category: Regex flags

/i (Case-Insensitive)

Explained by Updated

What is /i (Case-Insensitive)?

/i (Case-Insensitive): Match letters regardless of upper/lower case. The i flag makes a pattern ignore upper and lower case. /hello/i matches Hello, HELLO and hello. It is available in nearly every regex engine, written as /i in JavaScript and PHP or re.IGNORECASE in Python. Use it for input that people type, such as search boxes, commands or email domains. Users do not think about case, and your matching should not force them to.

Definition source Coders Lingo, CC BY 4.0

Frequently asked questions about /i (Case-Insensitive)

What should you keep in mind with /i (Case-Insensitive)?

It is not a complete answer for comparing text, though. Some languages have case rules that a regex flag handles poorly, such as the German ß or the Turkish dotted i. For comparing whole values, such as checking whether an email address already exists, normalize both values with a proper lowercase function or use a case-insensitive database collation. Keep the flag for searching inside text.

At a glance

CategoryRegex flags
Explained by
Updated

More Regex flags terms

All terms starting with a number or symbol

Skills

Download all skills (zip)

Manuals

Related services

Need any help?

Stuck on one of these in your own project? Tell me what you are working on and I will tell you how I would approach it.