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 ( #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
Node Status?
node history
Node Type: note [id://649291]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (8)
As of 2020-07-08 11:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?