repl: removing the buggy trimWhitespace function
As it is, the trimWhitespace function will not remove the white sapce characters at the end of the string, as the greedy capturing group .+ captures everything till end of the string, leaving \s* with nothing. This patch removes the function and uses a proper RegEx which will match all the whitespace characters at the beginning and ending of the string and replaces the matched whitespace characters with empty string.
This is a floating fix till https://github.com/nodejs/io.js/pull/2163 lands
cc @chrisdickinson