Does the same issue apply for tabs too? If so, this should be `/\s+$/`