x <- "my string is sad"
sub(" .*", "", x)
sub("[[:space:]].*", "", x)
sub("(*UCP)(?s)\\s.*", "", x, perl=TRUE) # PCRE Unicode-aware regex
## stringr::str_replace(x, "(?s) .*", "") # (?s) will force . to match any chars
eCA8LSAibXkgc3RyaW5nIGlzIHNhZCIKc3ViKCIgLioiLCAiIiwgeCkKc3ViKCJbWzpzcGFjZTpdXS4qIiwgIiIsIHgpCnN1YigiKCpVQ1ApKD9zKVxccy4qIiwgIiIsIHgsIHBlcmw9VFJVRSkgIyBQQ1JFIFVuaWNvZGUtYXdhcmUgcmVnZXgKIyMgc3RyaW5ncjo6c3RyX3JlcGxhY2UoeCwgIig/cykgLioiLCAiIikgICAjICg/cykgd2lsbCBmb3JjZSAuIHRvIG1hdGNoIGFueSBjaGFycw==