my $cust_code = “SILICONEXSiliconex-wafers”;
my $pattern = "SILICONEX((?i)siliconex-wafers)";
if ($cust_code =~ /$pattern/){
print "[$&]\n";
}
__END__
[SILICONEXSiliconex-wafers]
####
my $pattern = "(?i)SILICONEXsiliconex-wafers";
if ($cust_code =~ /$pattern/){
print "$&\n";
}
##
##
• a pattern that is searched with a certain flag for a part of the pattern and that which has no flags in the pattern
• to sub-group the pattern and effectively use flags of
(?m) as /m for mult-line strings,
(?s) as /s for single line strings,
(?x) as /x for extended search including comment lines and space delimiters and
(?i) as /i for case sensitive pattern notation
or a combination of the flags
##
##
my $sub_contract="SILICONEXsiliconex-wafers ^M NOTE1-- a shipment in ^M backlog calc note for
the shipping dates the contract is delivered ";
my $pattern = "SILICONEX((?i)siliconex-wafers)";
if ($sub_contract =~ /$pattern/)
{
$sub_contract =~ s/(?m:(\^M|--))/ /g;
my ($shipment_note, $sub_contract_keynote ) =
reverse split(/(?i)NOTE/ ,$sub_contract);
print "[ $sub_contract_keynote ] [ $shipment_note ]\n";
}
__END__
[ for
the shipping dates the contract is delivered ] [ 1 a shipment in backlog calc note ]
##
##
s/(?m:(\^M|--))/ /g
##
##
(?= indicates a positive forward(look_ahead) assertion
(?! indicates a negative forward(look_ahead) assertion
(?<= indicates a positive backward(look_behind) assertion
(?##
$product = "MOTOROLAx|xx|xx|x01-01-1900x|xYx|x";
$product =~ s/x\|xx\|x/x\|x x\|x/g;
print "[ $product ]\n";
__END__
[ MOTOROLAx|x x|xx|x01-01-1900x|xYx|x ]
##
##
[ MOTOROLAx|x x|xx|x01-01-1900x|xYx|x ]
##
##
$product = "MOTOROLAx|xx|xx|x01-01-1900x|xYx|x";
$product =~ s/(?<=\|)xx(?=\|)/x x/g;
print "[ $product ]\n";
__END__
[ MOTOROLAx|x x|x x|x01-01-1900x|xYx|x ]
##
##
$product = "MOTOROLAx|xx|xx|x01-01-1900x|xYx|xx";
$product =~ s/(?<=\|)xx(?=(\||$)/x x/g;
print "[ $product ]\n";
__END__
[ MOTOROLAx|x x|x x|x01-01-1900x|xYx|x x ]