🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: perl.perl6.users
Article #1

Re: Wierd regex

#1
From: 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
>>
>
Technical Details
Message-ID: <9e1b1840-0cde-4b77-9ec6-836af80339e5@wakelift.de>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!spool1.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!fu-berlin.de!bofh.it!nntp.perl.org
References: <5f601c08-6ebb-484c-a51a-15bf99f8f2c2@zoho.com> <8c6e3e00-2327-41d5-9ab1-2f18f5ebba4e@wakelift.de> <59c4de5c-37bd-4ff8-9237-d6dc8b68e018@zoho.com>

Show Full Headers
Complete Article Headers
Newsgroups: perl.perl6.users
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!spool1.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!fu-berlin.de!bofh.it!nntp.perl.org
Return-Path: <timo@wakelift.de>
Mailing-List: contact perl6-users-help@perl.org; run by ezmlm
Delivered-To: mailing list perl6-users@perl.org
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=perl.org; h=
	message-id:date:mime-version:subject:to:references:from
	:in-reply-to:content-type:content-transfer-encoding:reply-to; s=
	dr1; bh=s9OTelNjDP+lpZc7/qxqQjC3asX2scKMcQtLwQ6XzvM=; b=j6zRUIhx
	3qUlckvoA8YExW2n8DbSbURpKUv4R2LseYZtsnVq+drHnUZf6tCjsgd3IPU/N0T0
	Bq/ymnXI1rjQxzVHFWD7L3aKUnCw5OcqIrw2BTkM3eYx+TVlqL7LgYvt2r8VM3gl
	y0P0QFTlS4xVkhcc9qCY8RWEWZwevoeogOVtwhPWzFy9n1E9zu8U82vlAaakqrBC
	tx1oBO4ZdBjqFdVeZd3a6+LNyQbPDjw4CPOS2kVJPLPafGxQ6QXWfATnkQPp32M3
	pNqrm/D0Rzo9zt7yNLr3AZ2BqnHGhQeBkxNRowaOagFP5as4zltp6YnZ3cnzRQo3
	VyszYvACFyYDDA==
Received: (qmail 31710 invoked from network); 5 Mar 2026 17:20:22 -0000
Received: from xx1.develooper.com (147.75.38.233) by x6.develooper.com with
 SMTP; 5 Mar 2026 17:20:22 -0000
Received: from inbound-egress-8.mailchannels.net
 (inbound-egress-8.mailchannels.net [23.83.223.254]) by xx1.develooper.com
 (Postfix) with ESMTP id 11D517C1A7 for <perl6-users@perl.org>; Thu,  5 Mar
 2026 09:20:21 -0800 (PST)
ARC-Seal: i=2; a=rsa-sha256; d=mailchannels.net; s=arc-2022; cv=pass;
 t=1772731218;
 b=VTFSl7isoan+w+5H4pOiTwhSI8ARRZdypaMNMv6+/thI5JED7+uwS8xAPxa3DK5HR8Lfjr
 mwj8VUtOJTi6eiHSvbMrBC7SToVBX4ZwRrykOYbFR9ARtqFjWRAFY4X5DVDIlDXh1iAlaH
 0JGIiSL/uc1RjXAL5AMQBEKyd7a/xrlxxjdRwnIDFza9lvqwGrfX4PKpJ9DtCfBmh2nB/h
 COkwwrb47YIQXPyJLCXuBJKJNfaj22Q2kSY1wMtNUd0oMQA1EIl5EN/YRb8/RSOPQ5Shpp
 Do5KvpQ1qosYvGWb51mDNVnnA8scUYU7WZTZMWPJD6gWBLj3vozxM6OXOeMZXg==
ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed;
 d=mailchannels.net; s=arc-2022; t=1772731218;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:mime-version:mime-version:content-type:content-type:
 content-transfer-encoding:content-transfer-encoding:
 in-reply-to:in-reply-to:references:references:dkim-signature;
 bh=s9OTelNjDP+lpZc7/qxqQjC3asX2scKMcQtLwQ6XzvM=;
 b=gtnBczR3VUNNghfJgYbFEac2kV4aYUdAD6rJJQTXxE8uGBp/aK/uUnAwoJb/hAH3bpq4Ew
 IlOMRJaVTiks68dnP+t4zbx462/7OesTZRoxmZpTmMdGVIH2R4Ks9iE71fiqiFFgN6hbnD
 I5dOWERRF1oyZJRQv08eS2LlsbVYQHf+t523f1ZYxnXUSHOeZfU1xkIP8VlCkJ+Tuuv2lr
 eOKuZWFk+7ZlJ/hEIQTwZuNInYHdf2kLt5vcUAgApI70OMkbykFeqBrD721utwpfcht9z1
 UwadOlGocEaEQSy15tzpOIFEe0lImBO2qn7xIPgMLmL5wUjiJt/6ACc5bZnpDg==
ARC-Authentication-Results: i=2; inbound-rspamd-59f67b687b-fjx4c; arc=pass
 ("wakelift.de:s=key01:i=1")
X-Message-ID: fVQ5NvHj0EkhYRiZMHQdMVIu
Received: from mail.aperture-labs.org (mail.aperture-labs.org
 [195.191.197.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by
 100.105.174.242 (trex/7.1.3); Thu, 05 Mar 2026 17:20:21 +0000
Authentication-Results: inbound.mailchannels.net; spf=pass
 smtp.mailfrom=timo@wakelift.de; dkim=pass header.d=wakelift.de; dmarc=pass
 (policy=reject; pct=100; status=pass); arc=pass (i=1)
Received-SPF: pass (dmarc-service-78968d7585-d58kn: domain of wakelift.de
 designates 195.191.197.3 as permitted sender) client-ip=195.191.197.3;
 envelope-from=timo@wakelift.de; helo=mail.aperture-labs.org;
ARC-Seal: i=1; a=rsa-sha256; d=wakelift.de; s=key01; cv=none; t=1772731213;
 b=B4kIQPy+MRfJQUn4FRDU8mJQeAjkyFPVvzzAd/8xyGFoyYepMG5uxQBZobst+BREm1lddP
 zOF3LMDEQwgqz+we5GhNeQEKir6JupfK+a9o3uM+H9QeEG2uDlk51ELB4ZPXsBysZBpkuq
 IUOubDa8UKCZ/yF3H//XjjbcnGDU22w=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=wakelift.de;
 s=key01; t=1772731213;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:mime-version:mime-version:content-type:content-type:
 content-transfer-encoding:content-transfer-encoding:
 in-reply-to:in-reply-to:references:references;
 bh=s9OTelNjDP+lpZc7/qxqQjC3asX2scKMcQtLwQ6XzvM=;
 b=PbhLLA7xLXiJoIjPuC7krZiqgxyB/Dql/xOhmR3inAblMwu2h3KkTuVvWAz+03pqJUpZ8n
 noUJawx4WKx6Y9JhXLDzzOhEjgT+iOs0ubVA8Zn8BXekbmnQJ6VcaKGFDjq8w0K9bawR26
 PClUgrrrf9JbNIaKnAHDtOQw+ShmKp4=
ARC-Authentication-Results: i=1; mail.aperture-labs.org; auth=pass
 smtp.auth=timo@wakelift.de smtp.mailfrom=timo@wakelift.de
Received: by mail.aperture-labs.org (OpenSMTPD) with ESMTPSA id 2c9986de
 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) auth=yes user=timo@wakelift.de for
 <perl6-users@perl.org>; Thu, 5 Mar 2026 17:20:13 +0000 (UTC)
Message-ID: <9e1b1840-0cde-4b77-9ec6-836af80339e5@wakelift.de>
Date: Thu, 5 Mar 2026 18:20:11 +0100
MIME-Version: 1.0
User-Agent: Betterbird (Linux)
Subject: Re: Wierd regex
To: perl6-users@perl.org
References: <5f601c08-6ebb-484c-a51a-15bf99f8f2c2@zoho.com>
 <8c6e3e00-2327-41d5-9ab1-2f18f5ebba4e@wakelift.de>
 <59c4de5c-37bd-4ff8-9237-d6dc8b68e018@zoho.com>
Content-Language: en-US
In-Reply-To: <59c4de5c-37bd-4ff8-9237-d6dc8b68e018@zoho.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Original-From: Timo Paulssen <timo@wakelift.de>
Reply-To: Timo Paulssen <timo@wakelift.de>, 
Approved: news@nntp.perl.org
From: perl6-users@perl.org (Timo Paulssen via perl6-users)