Get startedGet started for free

A case study on case

1. A case study on case

You know by now that regular expression patterns are case sensitive:

2. regex are case sensitive

dog won't match Dog. But in practice you are often confronted with needing to find matches regardless of their case. For example, you need to know which strings contain dog, whether it is at the start of a sentence or not. To illustrate the problem I've put together a set of accident narratives that involve cats, or as I like to call them catcidents. The problem with these narratives is that they were written by many people, some who like to write all in upper case, some who

3. regex are case sensitive

like to write all in lower case, some

4. regex are case sensitive

capitalize the start of every word and some

5. regex are case sensitive

who seem to playing with case just to mess with you. If you want to find the narratives

6. Case sensitive matching

that also involve the word food, You'll only pick up the narratives that spell food all in lower case. You could try a lot of variants but you must be wondering if there is a better way. There is! In the following exercises you'll learn about

7. Change case of input

two strategies: transforming the input strings to a uniform case, or

8. Use case insensitive matching

altering the match so it is done in a case insensitive way.

9. Let's practice!

To finish up you'll turn all the catcidents into uniform sentence case.