Re: regular expression problem ? and * characters



"compboy" <compboyxyz@xxxxxxxxx> wrote in news:1148814168.551306.197780@
38g2000cwa.googlegroups.com:

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, $_");
}
}

No it isn't. That's not Perl. It won't compile.

Please show your actual code, not something that "looks like it."

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

perldoc -f quotemeta
.



Relevant Pages

  • Re: how to install with CPAN
    ... > But when I compile the program I get the message as ... Will provide information about most of the errors you see so if Perl ... perldoc -f require ...
    (perl.beginners)
  • RE: Trying to match windows path
    ... Still very noob when it comes to perl. ... I can put the actual string into m//i, which would work, but I have to make it work with variable, since I'll be reading in the actual string from a file. ... To match non-alphanumeric characters in a string, you need to quotemeta ... perldoc quotemeta ...
    (perl.beginners)
  • Re: Trying to match windows path
    ... Still very noob when it comes to perl. ... I can put the actual string into m//i, which would work, but I have to make it work with variable, since I'll be reading in the actual string from a file. ... To match non-alphanumeric characters in a string, you need to quotemeta ... perldoc quotemeta ...
    (perl.beginners)
  • Re: Questions about "perldoc perlembed"
    ... Ultimately I am trying to embed the ability to run Perl scripts on ... Perl to properly embed in my Win32 C++ program. ... COMPILE THE PROGRAMS IN EXACTLY THE SAME ... Eventually I read the section "Maintaining multiple interpreter ...
    (comp.lang.perl.misc)
  • Questions about "perldoc perlembed"
    ... Ultimately I am trying to embed the ability to run Perl scripts on ... Perl to properly embed in my Win32 C++ program. ... COMPILE THE PROGRAMS IN EXACTLY THE SAME ... Eventually I read the section "Maintaining multiple interpreter ...
    (comp.lang.perl.misc)