in reply to Regex: Matching last of repeated character to end of string

I wouldn't use greediness at all. I'd use "Not this character" matches:
use warnings; use strict; my $xpath = 'BoringNode[1]/InterestingNode[@InterestingAttribute="outg +rabe"]/AnotherBoringNode[5]'; $xpath =~ s|\/[^/]+$||; print $xpath . "\n";
That's "any character that isn't a slash"

davis
Kids, you tried your hardest, and you failed miserably. The lesson is: Never try.