L
lmcosorio
Hi Everyone,
I've been learning Perl for about 6 months. This is my first post to
the group as it's also the first time i couldn't find an answer on this
group or elsewhere.
Here's my problem. I want to match a line from a file with the
following conditions:
1 - It starts with aaa?
2 - Has random characthers following the "?"
3 - ends with s=196
1 & 2 are variables.
Below is a sample script a wrote that shows (almost) what i need. I use
the \Q modifier because of the "?" on the 1st variable.
I can't seem to figure out how to match randoms characters between
$var1 and $var2. To make things harder (at least for me) the randoms
characters can contain special regex characters.
use strict;
use warnings;
my $match1='aaa?';
my $match2='s=196';
my $var='aaa?s=196';
if ($var =~ /\Q$match1$match2/)
{
print "It matched...";
}
where i have:
if ($var =~ /\Q$match1$match2/)
i need to have
if ($var =~ /\Q$match1[match any random characters]$match2/)
Any help apreciated.
I hope my question is understandable and please forgive my english.
Regards,
Luis
I've been learning Perl for about 6 months. This is my first post to
the group as it's also the first time i couldn't find an answer on this
group or elsewhere.
Here's my problem. I want to match a line from a file with the
following conditions:
1 - It starts with aaa?
2 - Has random characthers following the "?"
3 - ends with s=196
1 & 2 are variables.
Below is a sample script a wrote that shows (almost) what i need. I use
the \Q modifier because of the "?" on the 1st variable.
I can't seem to figure out how to match randoms characters between
$var1 and $var2. To make things harder (at least for me) the randoms
characters can contain special regex characters.
use strict;
use warnings;
my $match1='aaa?';
my $match2='s=196';
my $var='aaa?s=196';
if ($var =~ /\Q$match1$match2/)
{
print "It matched...";
}
where i have:
if ($var =~ /\Q$match1$match2/)
i need to have
if ($var =~ /\Q$match1[match any random characters]$match2/)
Any help apreciated.
I hope my question is understandable and please forgive my english.
Regards,
Luis