loris has asked for the wisdom of the Perl Monks concerning the following question:
Hello all,
I wanted to remove the final section of an XPath string using a regex. I obviously don't understand non-greediness, because I though this would work:
my $xpath = 'BoringNode[1]/InterestingNode[@InterestingAttribute="outg +rabe"]/AnotherBoringNode[5]'; $xpath =~ s|\/(.*?)$||; print $xpath . "\n";
I had hoped to get
BoringNode[1]/InterestingNode[@InterestingAttribute="outgrabe"]
Can anyone help?
Thanks,
"It took Loris ten minutes to eat a satsuma . . . twenty minutes to get from one end of his branch to the other . . . and an hour to scratch his bottom. But Slow Loris didn't care. He had a secret . . ."
Back to
Seekers of Perl Wisdom