Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: regexp - repeatedly delete words expressed in alternation from end of string (KISS)

by tye (Sage)
on Nov 06, 2007 at 17:56 UTC ( [id://649291]=note: print w/replies, xml ) Need Help??


in reply to repeatedly delete words expressed in alternation from end of string [regexp]

I'm a bit surprised that I didn't notice anybody offering the simple, obvious solution:

s/(\s+$RE)+$//;

(tested) Update: One was hidden in the middle of gamache's sentence.

- tye        

  • Comment on Re: regexp - repeatedly delete words expressed in alternation from end of string (KISS)
  • Download Code

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (5)
As of 2024-04-25 08:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found