Changeset 27970

Show
Ignore:
Timestamp:
05.08.2013 17:05:24 (6 years ago)
Author:
ak19
Message:

Fix to regex. The regex sorting the ordering of the generated paged_img files needed to be corrected: the extra question mark makes the match less greedy. Before, the .* would match all the characters up to but exluding the last digitbefore the file extension. Instead, we want it to match all the chars up to but excluding the first digit (in a sequence of consecutive digits) before the file extension.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/util.pm

    r27819 r27970  
    12271227    sub page_number { 
    12281228    my ($dir) = @_; 
    1229     my ($pagenum) =($dir =~ m/^.*[-\.]?(\d+)(\.(jpg|gif|png))?$/i); 
     1229    my ($pagenum) =($dir =~ m/^.*?[-\.]?(\d+)(\.(jpg|gif|png))?$/i); 
     1230#   my ($pagenum) =($dir =~ m/(\d+)(\.(jpg|gif|png))?$/i); # this works but is not as safe/strict about input filepatterns as the above 
    12301231 
    12311232    $pagenum = 1 unless defined $pagenum;