Skip to content

Improve regex#46

Merged
bramp merged 3 commits intobramp:progressfrom
stonio:stonio-improve-regex
Jun 24, 2016
Merged

Improve regex#46
bramp merged 3 commits intobramp:progressfrom
stonio:stonio-improve-regex

Conversation

@stonio
Copy link
Copy Markdown
Contributor

@stonio stonio commented Jun 23, 2016

No description provided.

stonio added 2 commits June 23, 2016 15:58
Use non-capturing group for decimal part.
Use Predefined character class "\w".
*/
public static long parseBitrate(String bitrate) {
Pattern p = Pattern.compile("(\\d+(\\.\\d+)?)kbits/s");
Pattern p = Pattern.compile("(\\d+(?:\\.\\d+)?)kbits/s");
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Can we now drop the last ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We have to keep both symbols ? because they have different roles:

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Ah yes, now I understand what the ?: was doing.

Escape backslash in regex.
@bramp bramp merged commit 3fd02f6 into bramp:progress Jun 24, 2016
@stonio stonio deleted the stonio-improve-regex branch June 24, 2016 10:19
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