Capital sensitive when labeling by case-senstive

Hello, I am wondering whether the word 'doctor' in my script is capital sensitive or not.
And if every variable that contains the word ' doctor' will be categorized as 23?

research <- work_sector_new %>%
mutate(
label = case_when(
str_detect(work_sector, "doctor") ~ "23",

Here are examples of searching with and without case insensitivity using the tag (?i).

library(dplyr)
library(stringr)
work_sector_new <- data.frame(work_sector=c("a doctor", "The Doctor", "mechanic",
                                             "doctorate"))

#Case sensitive version
work_sector_new %>%
   mutate(
     label = case_when(
       str_detect(work_sector, "doctor") ~ "23"))

    work_sector label
1    a doctor    23
2  The Doctor  <NA>
3    mechanic  <NA>
4   doctorate    23
 
#Case insensitive version
work_sector_new %>%
   mutate(
     label = case_when(
       str_detect(work_sector, "(?i)doctor") ~ "23"))

    work_sector label
1    a doctor    23
2  The Doctor    23
3    mechanic  <NA>
4   doctorate    23
1 Like