🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: perl.perl6.users
1 messages
1 total messages Started by Timo Paulssen via perl6-users Thu, 05 Mar 2026 17:20
Re: Wierd regex
#1
Author: Timo Paulssen via perl6-users
Date: Thu, 05 Mar 2026 17:20
164 lines
11111 bytes
When I run your code, with or without the `sleep` commands, it seems to 
work. I opened the source code of the page using my browser because with 
just `curl` it gave me a different page. I assume this is what you 
created CurlImpersonate for, to pretend to the website that you're a 
"real browser" and not a script.

rakudo -e '         my $NewRev  = "icedrive_download.html".IO.slurp;
         # <meta name="description" content="Download Icedrive 3.56 - 
Back up and access your files from wherever w
ith this cloud solution, capable of acting as if it were a physical 
drive on your computer">
# print "1.2\n";

         $NewRev ~~ s/ .*? $( Q[Download Icedrive ] ) //;
# print "1.5\n";

         $NewRev ~~ s/ $( Q[ ] ) .* //;
# print "2\n";

         if $NewRev.chars > 40  { $NewRev = 0; }
# print "3\n";


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

         say "SubName: \n" ~
                                 "   NewRev    =  <$NewRev>\n" ~
                                 "   ClickHere =  <$ClickHere>\n\n"; '
SubName:
   NewRev    =  <3.56>
   ClickHere = 
  <https://cdn.icedrive.net/static/apps/win/IcedriveSetup-v3.56.exe>

I'm sorry, I'm not sure what exactly is going wrong when you try it that 
causes the difference :(

Hope that helps anyway,
   - Timo

On 3/4/26 01:36, ToddAndMargo via perl6-users wrote:
> 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
>>
>
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads