Author Topic: 404 Not Found Server Error  (Read 8173 times)

Offline Mars

  • Operator
  • Tireless poster
  • *****
  • Posts: 1961
    • View Profile
Re: 404 Not Found Server Error
« on: October 15, 2015, 02:25:24 PM »
the error "404 not found"  here  comes from this line in scriptlib.pas

s:=reReplace(s,'%([-a-z0-9]+%)',''$1', 'mi');

Regular Expression is the problem


    % matches the character % literally
    1st Capturing group ([-a-z0-9]+%)
        [-a-z0-9]+ match a single character present in the list below
            Quantifier: + Between one and unlimited times, as many times as possible, giving back as needed [greedy]
            - the literal character -
            a-z a single character in the range between a and z (case sensitive)
            0-9 a single character in the range between 0 and 9
        % matches the character % literally

I guess the purpose of this mask is to replace a variable of type %my_var% by its equivalent 'myvar

the problem is that detection also includes normally separated pairs of %xx

"New folder (2).txt"  --> converted in url to "New%20folder%20(2).txt"

by applying the mask:

"New%20folder%20(2).txt"  becomes "New'folder20(2).txt"

it's will be necessary to ignore replace when % is followed by a number,  because a hfs var always begin by a non numeric char

should be taken into account in the new version the following scenario:

"new %myvar%20 folders" -->> "new 'myvar20 folders"
 here, %20 is not a space character and have not to be converted

changing somewhat groping the mask could give a result that seems correct, but will require the approval of any modification to validate rejetto
« Last Edit: October 15, 2015, 05:23:02 PM by Mars »

Follow members gave a thank to your post: