in reply to RegEx and Packaging Name Problem

while ($dna1 =~ s/\s/GA{ACT}TC/g){ print "Found GA{ACT}TC at", pos($dna1)-4, "\n"; }

If you've read pos then you will notice it says 'Returns the offset of where the last "m//g" search left off' but you are not using m//g.

Your message says "Found GA{ACT}TC" but your search pattern is /\s/ which is a single whitespace character.

By "pos($dna1)-4" I assume that you want the start of the pattern but a single whitespace character is only one character long and the string "GA{ACT}TC" is 9 characters long?

Replies are listed 'Best First'.
Re^2: RegEx and Packaging Name Problem
by blarsen (Initiate) on Oct 22, 2010 at 01:37 UTC
    Thanks for the help everyone. And the string I'm looking for is only 5 characters long, it's really GAACTTC but I just wrote it differently when I brought it over - sorry about the confusion. So, only doing -4 to get the start of the pattern as a non-programmer would count.