Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/java/net/bramp/ffmpeg/FFmpegUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public static String millisecondsToString(long milliseconds) {
* @return
*/
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.

Matcher m = p.matcher(bitrate);
if (!m.find()) {
throw new IllegalArgumentException("Invalid bitrate '" + bitrate + "'");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public String spec() {
public static String checkValidKey(String key) {
checkNotNull(key);
checkArgument(!key.isEmpty(), "key must not be empty");
checkArgument(key.matches("[a-zA-Z0-9_]+"), "key must only contain letters, numbers, and _");
checkArgument(key.matches("\\w+"), "key must only contain letters, numbers or _");
return key;
}

Expand Down