Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Regex: Matching last of repeated character to end of string

by davis (Vicar)
on Nov 04, 2005 at 12:32 UTC ( [id://505687]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://505687]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (2)
As of 2025-03-17 04:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When you first encountered Perl, which feature amazed you the most?










    Results (54 votes). Check out past polls.