fork download
  1. str <- 'This is a _string with_ some _random underscores_ in it.'
  2. gsub("_+([\x20-\x5E\x60-\x7E]+)_+", "\\1", str)
  3.  
  4. str <- 'This is a _random string with_ a scale of 1_10.'
  5. gsub("_+([\x20-\x5E\x60-\x7E]+)_+", "\\1", str)
Success #stdin #stdout 0.3s 22832KB
stdin
Standard input is empty
stdout
[1] "This is a string with some random underscores in it."
[1] "This is a random string with a scale of 1_10."