diff --git a/regexps.qmd b/regexps.qmd index 4e60814..c6b642d 100644 --- a/regexps.qmd +++ b/regexps.qmd @@ -187,7 +187,7 @@ That's because regular expressions are case sensitive. There are three ways we could fix this: - Add the upper case vowels to the character class: `str_count(name, "[aeiouAEIOU]")`. -- Tell the regular expression to ignore case: `str_count(regex(name, ignore_case = TRUE), "[aeiou]")`. We'll talk about more in @sec-flags. +- Tell the regular expression to ignore case: `str_count(name, regex("[aeiou]", ignore_case = TRUE))`. We'll talk about more in @sec-flags. - Use `str_to_lower()` to convert the names to lower case: `str_count(str_to_lower(name), "[aeiou]")`. This variety of approaches is pretty typical when working with strings --- there are often multiple ways to reach your goal, either by making your pattern more complicated or by doing some preprocessing on your string.