in reply to regular expression ?!

What have you done so far? Show us the code, maybe it can be easily extended.

Replies are listed 'Best First'.
Re^2: regular expression ?!
by Anonymous Monk on May 05, 2009 at 12:48 UTC
    #!/usr/local/bin/perl use strict; use Getopt::Long; use sql_engine; my $string = "XXX2EX_"; #my (@grepnam, @names); while(<>) { chomp; if ($_ =~/SNP*/i) { #print $_, "\n"; if ($_ =~s/BM*/$string/) { print $_, "\n"; } } }
      Sorry its me again. In may actual code it works as if ($_ =~s/BM*/XXXEX_BM/)
        If you add a g modifier to the end of the substitution, it will substitute all occurrences. See perlretut for details.

        And beware, the regular expression doesn't do what you think it does - read the documentation to learn what the * does.