regular expression problem ? and * characters



Im writing a perl script now and this is part of the sricpt

chomp = ($pattern = ARGV[0]);

for each(@thisarray)
{
if($_ =~ m/$pattern/i)
{
print ("found it here, $_");
}
}

the array @thisarray is given.

this scprit reads from the command line and pass that input the the
pattern
and will check if the pattern match the any string inside the array it
will
print the msg.

I have done this part succesfully if the input is just a normal string
like a ab

my question is how do you imporve it so it can accept the input that
contains* and ?
character(s) like *ab? a*b* *a*

thanks a lot.

.



Relevant Pages

  • regular expression problem ? and * characters
    ... the array @thisarray is given. ... this scprit reads from the command line and pass that input the the ... and will check if the pattern match the any string inside the array it ... I have done this part succesfully if the input is just a normal string ...
    (comp.lang.perl.misc)
  • regular expression problem ? and * characters
    ... the array @thisarray is given. ... this scprit reads from the command line and pass that input the the ... and will check if the pattern match the any string inside the array it ... I have done this part succesfully if the input is just a normal string ...
    (perl.beginners)
  • Re: regular expression problem ? and * characters
    ... the array @thisarray is given. ... this scprit reads from the command line and pass that input the the ... and will check if the pattern match the any string inside the array it ... I have done this part succesfully if the input is just a normal string ...
    (comp.lang.perl.misc)
  • Re: newbie help - finding all substrings with index?
    ... > the instances of a substring within it, save it in an array, then print ... > presume I will then be able to use split to get the raw prices out of ... But why do you think you need an array? ... pattern match. ...
    (comp.lang.perl.misc)
  • Re: pattern match
    ... I'm facing the pattern match problem: ... Why are you storing the scalar value returned from GetCwdinto the array @ARGV? ... You are stat()ing the same file twice when you only have to statit once: ... That is because even though you are using a regular expression you are not ...
    (perl.beginners)