Skip to content

Conversation

@thefourtheye
Copy link
Contributor

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 #2163 lands

cc @chrisdickinson

@mscdex mscdex added the repl Issues and PRs related to the REPL subsystem. label Jul 15, 2015
@alexlamsl
Copy link

Why won't String.prototype.trim() suffice here?

@thefourtheye
Copy link
Contributor Author

@alexlamsl True, but the other PR I submitted has needs to trim either the start or the end of the string. So I thought this will be consistent.

@silverwind
Copy link
Contributor

LGTM, thought I'd also prefer to use standard .trim(), which is probably faster than your regex.

@Fishrock123
Copy link
Contributor

This is a floating fix till #2163 lands

@silverwind maybe you could also just review #2163? I'd prefer it landed.

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
@thefourtheye
Copy link
Contributor Author

@silverwind @alexlamsl PTAL. Working on #2163's review comments.

@silverwind
Copy link
Contributor

LGTM 👍

@Fishrock123
Copy link
Contributor

Closing in favor of #2163 since it's pretty well reviewed.

@thefourtheye thefourtheye deleted the repl-regex-fix branch July 23, 2015 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

repl Issues and PRs related to the REPL subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants