Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

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

by toolic (Bishop)
on Nov 06, 2007 at 16:00 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://649242]
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-18 23:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found