my $RE = qr! \b ( SA | NV | LTD | CO | LLC ) \b !ix ; my $s1 = 'Bobs Warehouse SA LTD'; my $s2 = 'Jims Fine Wines CO LLC'; 1 while $s1 =~ s{$RE}{}; 1 while $s2 =~ s{$RE}{}; print "[$s1]\n[$s2]\n"; __END__ [Bobs Warehouse ] [Jims Fine Wines ]
In reply to Re: regexp - repeatedly delete words from end of string with words in alternation
by kyle
in thread repeatedly delete words expressed in alternation from end of string [regexp]
by princepawn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |