Skip to content

Conversation

jdneo
Copy link
Member

@jdneo jdneo commented Mar 12, 2019

Resolve #112

@jdneo jdneo added this to the 0.13.0 milestone Mar 12, 2019
@jdneo jdneo requested review from poppinlp and Vigilans March 12, 2019 12:23
private tryParseUserName(output: string): string {
const lines: string[] = output.trim().split(/\r?\n/);
if (lines.length === 3) {
const reg: RegExp = /^\s*.{1}\s*(.+)\s*https:\/\/leetcode/;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The regex executing on

'    ×      vigilans             https://leetcode-cn.com'

will return

'vigilans             '

Append ? to .+ to prevent greedy match could solve the problem.

Besides, is there any difference between .{1} and .?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

Copy link
Contributor

@Vigilans Vigilans left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I neglected the trim() in last review.

@jdneo jdneo merged commit be4f2d5 into master Mar 13, 2019
@jdneo jdneo deleted the cs/statusbar branch March 13, 2019 07:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants