In Perl if I had trailing blanks in a string, I would use this code
$line =~ s/ +$//;
Swift provides no support for regular expressions. It doesn't need to, though, because the only place you'll ever use Swift is in the presence of Cocoa — and Cocoa's Foundation framework does provide support for regular expressions (and has other string-handling commands). Swift String and Framework's NSString are bridged to one another.
Thus, you could use
stringByReplacingOccurrencesOfString:withString:options:range: with a regular expression pattern, for example (assuming that
stringByTrimmingCharactersInSet: is too simple-minded for your purposes).