in reply to Empty pattern in regex
Hello choroba,
I don't like to give up without exhausting all avenues of research, and for me Perl is enjoyment and therapy (needed in this world we live in, and this age). This issue may now have dropped off the radars of the other participants, but not mine. jo37 came up with:
perl -le 'print for a .. h' | perl -nle 'if (my $ff = (/d/ .. /h/)) { +next unless $ff =~ /(?:^1|E0)$/; print }' d h
which troubles me because of that alternation and the absence of //, which I think is/was your point. Mine are, granted, after debugging with strategic print statements:
perl -le 'print for a .. z' | perl -nle 'if (/d/ .. /h/) { next unles +s // and $_ eq $&; print; }' d h
or
perl -le 'print for a .. z' | perl -nle 'if (/d/ .. /h/) { next unles +s $_ eq $& and //; print; }' d h
and is a short-circuit operator so it works either way. Does this do what you expected it to do?
Regards, Will
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Empty pattern in regex
by jo37 (Curate) on Oct 23, 2023 at 18:04 UTC | |
Re^2: Empty pattern in regex
by choroba (Cardinal) on Oct 23, 2023 at 17:52 UTC |