First of all, your fist line contains a bug, unless the topic variable ($_) is set to something meaningful.
Because the regex after the 'and' matches against said topic. See:

~$ perl -E '$_ = "bar"; say ("foo" =~ /f+/ and /o/)' # "", so false
~$ perl -E '$_ = "bar"; say ("foo" =~ /f+/ and /a/)' # "1", so true

I guess you wanted to match $ClickLine against both regexes.
In Perl 6 I would it as:

# Continue if any of the two match, that pipe char describes an alternation.
if $ClickLine ~~ / aes256 | $BaseTag / {
    push @WebClickHere, $ClickLine;

    # Capture all non-dash characters in $<VerLine>.
    if $Line ~~ / 'select id="' $<VerLine>=[ <-[-]>* ] / {
        push @WebVersions, $<VerLine>
    }
}

If $BaseTag contains a regex rule, say "fo+b.r", then you'd enclose it in angle brackets:
if $ClickLine ~~ / aes256 | <$BaseTag> / { # ...
This is alled a "regex assertion".


Am 12.01.2016 um 20:59 schrieb ToddAndMargo:
On 01/11/2016 11:24 PM, Tobias Leich wrote:
hi, what's in ${BaseTag}? Is it a regex rule or just a plain string?
(Because that matters in Perl 6)

It is a string and can vary.

Would you show me both ways to keep me out of trouble?


Am 12.01.2016 um 01:55 schrieb ToddAndMargo:
Hi All,

Would yo all terribly mind if I ask how to do this Perl 5 regex
in Perl 6?  (I learn best by example.)


<code>
if ( $ClickLine =~ /aes256/ and /${BaseTag}/ ) {
              push ( @WebClickHere, $ClickLine );

               if ( $Line =~ m{select id=\"(.*?)[-]} ) {
                  my $VerLine = $1;
                  push ( @WebVersions,  $VerLine );
               }
            }
</code>

Many thanks,
-T






Reply via email to