From 885dc6005f770df7cf60b52d84b7affb184526d7 Mon Sep 17 00:00:00 2001 From: mine-cetinkaya-rundel Date: Tue, 9 May 2023 23:02:42 -0400 Subject: [PATCH] Fix ignore case argument, closes #1455 --- regexps.qmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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.