Re: How to cut up a long line
[email protected] (ToddAndMargo via perl6-users)
| Newsgroups | perl.perl6.users |
|---|---|
| Message-ID | <[email protected]> |
> >> On Jan 10, 2025, at 17:50, ToddAndMargo via perl6-users <perl6- >> [email protected]> wrote: >> >> Hi All, >> >> I am scratching my head trying to figure out how to cut >> up this long line; >> >> >> download='betterbird-128.6.0esr-bb20.de.linux-x86_64.tar.bz2'><div >> class="img bz2"></div><div class="name"><div class="file fs-1-2 >> bold">betterbird-128.6.0esr-bb20.de.linux-x86_64.tar.bz2</div><div >> class="data upper size fs-0-7"><span class="bold">Size:</span> >> 80.26<span class="fs-0-8 bold">MB</span></div><div class="data upper >> modified fs-0-7"><span class="bold">Last modified:</span> Tue. January >> 7th, 2025 - 10:54pm</div></div></a></div><div class="block"><a >> href="LinuxArchive/betterbird-128.6.0esr-bb20.en-US.linux- >> x86_64.tar.bz2" class="bz2" download='betterbird-128.6.0esr-bb20.en- >> US.linux-x86_64.tar.bz2'><div class="img bz2"></div><div >> class="name"><div class="file fs-1-2 bold">betterbird-128.6.0esr- >> bb20.en-US.linux-x86_64.tar.bz2</div><div class="data upper size >> fs-0-7"><span class="bold">Size:</span> 80.04<span class="fs-0-8 >> bold">MB</span></div><div class="data upper modified fs-0-7"><span >> class="bold">Last modified:</span> Tue. January 7th, 2025 - 10:42pm</ >> div></div></a></div><div class="block"><a href="LinuxArchive/ >> betterbird-128.6.0esr-bb20.es-AR.linux-x86_64.tar.bz2" class="bz2" >> download='betterbird-128.6.0esr-bb20.es-AR.linux-x86_64.tar.bz2'><div >> class="img bz2"></div><div class="name"><div class="file fs-1-2 >> bold">betterbird-128.6.0esr-bb20.es-AR.linux-x86_64.tar.bz2</div> >> >> >> What I want to come out of it is an array of stings starting >> at "download" and ending at ">" or "<" >> >> download='betterbird-128.6.0esr-bb20.de.linux-x86_64.tar.bz2' >> download='betterbird-128.6.0esr-bb20.en-US.linux-x86_64.tar.bz2' >> download='betterbird-128.6.0esr-bb20.es-AR.linux- >> x86_64.tar.bz2'x86_64.tar.bz2 >> >> >> Many thanks, >> -T On 1/10/25 8:59 PM, William Michels via perl6-users wrote: > Hi Todd, > > ~$ raku -ne 'put $/.join("\n") if m:g/ <?before download> .*? <?before > \> | \h+ > /;' todd_test.txt > download='betterbird-128.6.0esr-bb20.de.linux-x86_64.tar.bz2' > download='betterbird-128.6.0esr-bb20.en-US.linux-x86_64.tar.bz2' > download='betterbird-128.6.0esr-bb20.es-AR.linux-x86_64.tar.bz2' > > See: https://docs.raku.org/syntax/%24%2F <https://docs.raku.org/syntax/ > %24%2F> > See: https://docs.raku.org/language/regexes#Lookahead_assertions > <https://docs.raku.org/language/regexes#Lookahead_assertions> > > OR: > > ~$ raku -ne 'put $/.join("\n") if m:g/ <( download .*? )> [ \> | > \h+ ] /;' todd_test.txt > download='betterbird-128.6.0esr-bb20.de.linux-x86_64.tar.bz2' > download='betterbird-128.6.0esr-bb20.en-US.linux-x86_64.tar.bz2' > download='betterbird-128.6.0esr-bb20.es-AR.linux-x86_64.tar.bz2' > > See: https://docs.raku.org/language/regexes#Capture_markers:_%3C(_)%3E > <https://docs.raku.org/language/regexes#Capture_markers:_%3C(_)%3E> > > Let me know if this is part of a larger script, how you're obtaining the > input line(s), etc., if you need more guidance. > > HTH, > > Bill. > Hi Bill, Thank you! I will not have the time to do any programming till maybe Sunday, so I will not have a chance till then to test this out. Yes, this is a simplification of a much larger program. The line in question is line 379 view-source:https://www.betterbird.eu/downloads/index.php The YUGE run on line. (I hate when they do that.) I am having a problem figuring out how to get your example into an array of strings. The long line will reside in my Str $AltClickHere; And the resulting array will reside in my @AltArray Would you mind showing me how to do that whilst I wait for some free time? Many thanks, -T