use strict; use warnings; my @strings = qw{ KHI0339B__P_H_Vita_Korangi_Ind_A HGW6120A__S_Popalzai_Cross_A }; my $rxPatt = qr{(?<=__)[A-Z]_}; foreach my $string ( @strings ) { print qq{Original: $string\n}; $string =~ s{$rxPatt}{} while $string =~ $rxPatt; print qq{Modified: $string\n\n}; }
The output is
Original: KHI0339B__P_H_Vita_Korangi_Ind_A Modified: KHI0339B__Vita_Korangi_Ind_A Original: HGW6120A__S_Popalzai_Cross_A Modified: HGW6120A__Popalzai_Cross_A
I hope this is of use.
Cheers,
JohnGG
In reply to Re: question : regex
by johngg
in thread question : regex
by greatshots
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |