Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

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

by jbware (Chaplain)
on Nov 04, 2005 at 12:30 UTC ( [id://505686]=note: print w/replies, xml ) Need Help??


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

What happens with your regex is it finds the first "/" it can, and then the ".*?" matches any character until the end. It sounds like you might want something more like this:
$xpathOther =~ s|/[^/]*$||;
This ensures that it matches on the last "/" it can find, and blanks it and everything after it out.

-jbWare

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2025-03-27 00:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When you first encountered Perl, which feature amazed you the most?










    Results (69 votes). Check out past polls.

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.