title: Match list of exact words from text
body: <p>I want to apply a function which can find the exact words in the text. I have a list of words, and I want to find the exact words in the given text. The provided code match the characters of words. And i need a solution which can match the exact words using r. Example code:</p>
  
  <pre><code>text &lt;- c("crew reported during climb aircraft would not pressurize and elected to perform an air turn back to fill. crew also reported forward cargo door message at 200 feet",
         "cargo door malfunction because the actor was pressing the open button during take off",
         "It is a time for next flight",
         "flight")
  
  keywords &lt;- c("cargo door","aircraft","pressurize","malfunction","flight")
  
  my_func &lt;- function(x){
  paste0(keywords[stringi::stri_detect_regex(x, keywords, case_insensitive=TRUE)], collapse = ", ")
  }
  
  outcome &lt;- sapply(text, my_func, USE.NAMES = FALSE)
  outcome
  [1] "cargo door, aircraft, pressurize" "cargo door, malfunction"          "light"                                
  [4] "light"
  </code></pre>
  
  <p>The above-mentioned function matched the character of the words but i need a function which can match the exact word. Any idea how to restrict the function with the particular word? </p>