Re: Wierd regex

[email protected] (ToddAndMargo via perl6-users) Tue, 3 Mar 2026 16:36:30 -0800
Newsgroups perl.perl6.users
Message-ID <[email protected]>
I did not change anything in the print or the sleep command.

This is the web stie I am carving the new revision out of:
  
view-source:https://www.softpedia.com/get/System/Back-Up-and-Recovery/Icedrive.shtml

Line 572: <meta name="description" content="Download Icedrive 3.56 - 
Back up and access your files from wherever with this cloud solution, 
capable of acting as if it were a physical drive on your computer">

The first regex removed everthing before the 3.56 and the
second one removed everythig after the 3.56.


    $RunResult = CurlImpersonate( $WebSite, "",  $SubName );

    if $RunResult.exitcode != 0  {
       $Status +|= %StatusHash<DOWNLOAD_FAIL>;
       PrintRedErr( "$SubName: failed to download WebSite\n 
<$WebSite>\n" );

     } elsif $RunResult.stdout.contains( Q[content="Download Icedrive] )  {
          $NewRev  = $RunResult.stdout;
          # <meta name="description" content="Download Icedrive 3.56 - 
Back up and access your files from wherever with this cloud solution, 
capable of acting as if it were a physical drive on your computer">
# print "1.2\n";
          sleep .2;
          $NewRev ~~ s/ .*? $( Q[Download Icedrive ] ) //;
# print "1.5\n";
          sleep .2;
          $NewRev ~~ s/ $( Q[ ] ) .* //;
# print "2\n";
          sleep .2;
          if $NewRev.chars > 40  { $NewRev = 0; }
# print "3\n";
          sleep .2;

          # 
https://cdn.icedrive.net/static/apps/win/IcedriveSetup-v3.56.exe --output
# print "4\n";
          $ClickHere  = 
Q[https://cdn.icedrive.net/static/apps/win/IcedriveSetup-v] ~ $NewRev ~ 
".exe";
# print "5\n";

          if $Debug  { PrintGreen "$SubName: \n" ~
                                  "   NewRev    =  <$NewRev>\n" ~
                                  "   ClickHere =  <$ClickHere>\n\n"; }

       } elsif $RunResult.stdout.contains( Q[Sorry, you have been] && 
Q[blocked] )  { ...







On 3/3/26 07:35, Timo Paulssen via perl6-users wrote:
> Hi Todd,
> 
> did you accidentally change more than just the sleep and print commands, 
> or did you give us an older version of the code that you ran?
> 
> I spot a difference where the code that doesn't work has "Icedrive" and 
> the one that does work has "drive", and the thing you're trying to match 
> against seems to have "drive" and not "Icedrive".
> 
> Hope that helps,
>    - Timo
> 
> 
> On 3/3/26 03:28, ToddAndMargo via perl6-users wrote:
>> Hi All,
>>
>> Fedora 43
>> RakudoPkgFedora43-01.01.x86_64.rpm
>>
>> This regex does not work:
>>
>>          $NewRev  = $RunResult.stdout;
>>          # <meta name="description" content="Download drive 3.56 - 
>> Back up and access your files">
>>          $NewRev ~~ s/ .*? $( Q[Download Icedrive ] ) //;
>>          $NewRev ~~ s/ $( Q[ ] ) .* //;
>>          if $NewRev.chars > 40  { $NewRev = 0; }
>>
>> Way to many characters.
>>
>>
>> But this does:
>>
>>          $NewRev  = $RunResult.stdout;
>>          # <meta name="description" content="Download drive 3.56 - 
>> Back up and access your files">
>>          sleep .2;
>>          $NewRev ~~ s/ .*? $( Q[Download drive ] ) //;
>>          sleep .2;
>>          $NewRev ~~ s/ $( Q[ ] ) .* //;
>>          sleep .2;
>>          if $NewRev.chars > 40  { $NewRev = 0; }
>>
>>
>> The sleep statements were originally debugging print statements.
>> The above worked when the print statement were active but
>> not when I commented them out.  So I substituted sleep for
>> print and it still worked.
>>
>> What the ....
>>
>> Yours in Confusion,
>> -T
>