str <- 'This is a _string with_ some _random underscores_ in it.'
gsub("_+([\x20-\x5E\x60-\x7E]+)_+", "\\1", str)
str <- 'This is a _random string with_ a scale of 1_10.'
gsub("_+([\x20-\x5E\x60-\x7E]+)_+", "\\1", str)
c3RyIDwtICdUaGlzIGlzIGEgX3N0cmluZyB3aXRoXyBzb21lIF9yYW5kb20gdW5kZXJzY29yZXNfIGluIGl0LicKZ3N1YigiXysoW1x4MjAtXHg1RVx4NjAtXHg3RV0rKV8rIiwgIlxcMSIsIHN0cikKCnN0ciA8LSAnVGhpcyBpcyBhIF9yYW5kb20gc3RyaW5nIHdpdGhfIGEgc2NhbGUgb2YgMV8xMC4nCmdzdWIoIl8rKFtceDIwLVx4NUVceDYwLVx4N0VdKylfKyIsICJcXDEiLCBzdHIp