Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: How to remove everything after last occurrence of a string?

by Fletch (Bishop)
on Jun 06, 2022 at 16:22 UTC ( [id://11144455]=note: print w/replies, xml ) Need Help??


in reply to How to remove everything after last occurrence of a string?

Something about this raises the "X/Y problem" hackles and makes me want to mumble something about using File::Spec and splitdir to break things up into a list of directory components instead (or Path::Tiny and doing . . . something). Or it could just be Monday and I'm making arbitrary connections that aren't there.

That aside the previous quotemeta answer(s) obviously fixes the X issue.

The cake is a lie.
The cake is a lie.
The cake is a lie.

Replies are listed 'Best First'.
Re^2: How to remove everything after last occurrence of a string?
by Anonymous Monk on Jun 06, 2022 at 20:28 UTC
    Something about this raises the "X/Y problem" hackles and makes me want to mumble something about using File::Spec and splitdir to break things up into a list of directory components instead (or Path::Tiny and doing . . . something).

    definitely x/y, look at the post history

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (3)
As of 2024-04-26 04:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found