I am trying to find some text patterns within my database.
I have a column with job titles (Data Analyst, Data Scientist etc.) and I'm trying to find all records with certain Job Title. I've been using following code:
grepl(".*Data.*Analyst.*, data$jobtitle, ignore.case = T)
If you want to check for the presence of both keywords "data" and "analyst" in any order, you can use positive lookaheads:
This will return true if both words are present, regardless of their order or the presence of other words:
grepl("(?=.*analyst)(?=.*data)",c("Analyst data","Data Analyst","Data scientist","Analyst Science data"),perl=T,ignore.case=T)  TRUE TRUE FALSE TRUE