Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

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

by toolic (Bishop)
on Nov 06, 2007 at 16:00 UTC ( #649242=note: print w/replies, xml ) Need Help??


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

use warnings; use strict; my $RE = qr! \b ( SA | NV | LTD | CO | LLC ) \b !ix ; while (<DATA>) { s/$RE//g; print; } __DATA__ Bobs Warehouse SA LTD Jims Fine Wines CO LLC

Outputs:

Bobs Warehouse Jims Fine Wines

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (6)
As of 2019-11-22 04:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Strict and warnings: which comes first?



    Results (108 votes). Check out past polls.

    Notices?