fork download
  1. foostring <- c("First test *** no asterisks at the end",
  2. "Second test *** asterisks in the middle *** something different",
  3. "Third test *** more than one asterisk *** something different *** second asterisk ***",
  4. "Fourth test *** asterisks followed by a special character ***_something different")
  5.  
  6. gsub("\\*{3}.*?(?:\\*{3}|$)", "", foostring)
  7.  
Success #stdin #stdout 0.21s 38972KB
stdin
Standard input is empty
stdout
[1] "First test "                      "Second test  something different"
[3] "Third test  something different " "Fourth test _something different"