diff options
author | trizen <trizen@protonmail.com> | 2020-03-14 02:08:16 +0200 |
---|---|---|
committer | Jesús <heckyel@hyperbola.info> | 2020-03-14 12:09:26 -0500 |
commit | 169a1be8cc6b2d71edf3308612de07338767f15c (patch) | |
tree | 65c7a8d1cea3b99087eb3f0ab8674f8ffe58af06 | |
parent | 7c60323c51dd57dbecea3d4e14f059e40b07bb54 (diff) | |
download | fair-viewer-169a1be8cc6b2d71edf3308612de07338767f15c.tar.lz fair-viewer-169a1be8cc6b2d71edf3308612de07338767f15c.tar.xz fair-viewer-169a1be8cc6b2d71edf3308612de07338767f15c.zip |
Support three-digit video selection.
Signed-off-by: Jesús <heckyel@hyperbola.info>
-rwxr-xr-x | bin/fair-viewer | 6 | ||||
-rw-r--r-- | lib/WWW/FairViewer/RegularExpressions.pm | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/bin/fair-viewer b/bin/fair-viewer index f6159bc..0600c20 100755 --- a/bin/fair-viewer +++ b/bin/fair-viewer @@ -1943,7 +1943,7 @@ sub get_user_input { if ($opt{history}) { my $str = join(' ', grep { /\w/ } @{$args}, @{$keywords}); - if ($str ne '' and $str !~ /^[0-9]{1,2}\z/) { + if ($str ne '' and $str !~ /^[0-9]{1,3}\z/) { $term->append_history(1, $opt{history_file}); } } @@ -2425,7 +2425,7 @@ sub get_reply { sub valid_num { my ($num, $array_ref) = @_; - return $num =~ /^[0-9]{1,2}\z/ && $num != 0 && $num <= @{$array_ref}; + return $num =~ /^[0-9]{1,3}\z/ && $num != 0 && $num <= @{$array_ref}; } sub adjust_width { @@ -3005,7 +3005,7 @@ sub get_valid_numbers { foreach my $id (split(/[,\s]+/, $input)) { push @output, $id =~ /$range_num_re/ ? get_range_numbers($1, $2) - : $id =~ /^[0-9]{1,2}\z/ ? $id + : $id =~ /^[0-9]{1,3}\z/ ? $id : next; } diff --git a/lib/WWW/FairViewer/RegularExpressions.pm b/lib/WWW/FairViewer/RegularExpressions.pm index 990426e..6c298f2 100644 --- a/lib/WWW/FairViewer/RegularExpressions.pm +++ b/lib/WWW/FairViewer/RegularExpressions.pm @@ -21,9 +21,9 @@ WWW::FairViewer::RegularExpressions - Various utils. my $opt_begin_chars = q{:;=}; # stdin option valid begin chars # Options -our $range_num_re = qr{^([0-9]{1,2}+)(?>-|\.\.)([0-9]{1,2}+)?\z}; +our $range_num_re = qr{^([0-9]{1,3}+)(?>-|\.\.)([0-9]{1,3}+)?\z}; our $digit_or_equal_re = qr/(?(?=[1-9])|=)/; -our $non_digit_or_opt_re = qr{^(?!$range_num_re)(?>[0-9]{1,2}[^0-9]|[0-9]{3}|[^0-9$opt_begin_chars])}; +our $non_digit_or_opt_re = qr{^(?!$range_num_re)(?>[0-9]{1,3}[^0-9]|[0-9]{4}|[^0-9$opt_begin_chars])}; # Generic name my $generic_name_re = qr/[a-zA-Z0-9_.\-]{11,34}/; |