fork(5) download
  1. x <- "my string is sad"
  2. sub(" .*", "", x)
  3. sub("[[:space:]].*", "", x)
  4. sub("(*UCP)(?s)\\s.*", "", x, perl=TRUE) # PCRE Unicode-aware regex
  5. ## stringr::str_replace(x, "(?s) .*", "") # (?s) will force . to match any chars
Success #stdin #stdout 0.22s 39592KB
stdin
Standard input is empty
stdout
[1] "my"
[1] "my"
[1] "my"