Reputation: 3
I have used below mentioned pattern to Search and extract the string form big string. example input string like
loadStringCombo('1',10,1,10,MaxCallApprComboBxId,quatstyle='width:50px;'quat)
Expected Output
(10,1,10,MaxCallApprComboBxId,)
But by this way i am getting only combobox1 as output.
while ( my $st = $str =~ /[0-9]+[\,][0-9]+[\,][0-9]+[\,][0-9a-zA-Z]+[\,]/g ) {
my $str3 = "combobox" . $st;
push @arry1, $str3 . "\n";
print @arry1, "\n";
open FILE, ">test.txt" or die $!;
print FILE @arry1, "\n";
}
Please guide me to extract the value 10,1,10,MaxCallApprComboBxId,.
Upvotes: 0
Views: 45
Reputation: 91415
Replace this line:
while ( my $st = $str =~ /[0-9]+[\,][0-9]+[\,][0-9]+[\,][0-9a-zA-Z]+[\,]/g ) {
by:
while ( my ($st) = $str =~ /(\d+,\d+,\d+,[0-9a-zA-Z]+,)/g ) {
whole loop:
while ($str =~ /(\d+,\d+,\d+,[0-9a-zA-Z]+,)/g ) {
push @arry1, "combobox$1";
}
use Data::Dumper;
print Dumper\@arry1;
open my $FILE, '>', 'test.txt' or die $!;
print $FILE "@arry1";
Upvotes: 1