Lesson

Ignore Case While Matching, Regular Expressions with JS 2020 Tutorial

Lesson Summary

In this addition in our journey to learn regular expressions, we look at what has probably been on your mind since you first understood what regular expressions are. The power to ignore casing when searching for a pattern, is an often used tool when creating regexes. We already learned a regex is denoted with the pattern we want to find inbetween two forward slashes. We are able to add flags, or options after the second forward slash that allow us further functionality. The 'i' flag allows us to ignore casing. The example regex we search for in this lesson is '/freeCodeCamp/', if we wanted to ignore casing so it would find the pattern 'freecodecamp' regardless of casing, we would add the 'i' flag in this manner, "/freeCodeCamp/i". Doing so would allow us to ignore casing when searching for the expressed pattern. In the next lessons, we will learn more flags and additional functionality available through the use of regular expressions.

Subscribe To Monthly Newsletter. Chance to Win Monthly Prizes

* indicates required


Share: