in reply to Re^3: need help with a regex
in thread need help with a regex
while ($content =~ /^[\w]+?([VMFWLCA]{8,})[\w]+?$/mg) { my $sequence = $1; print $header, "contains $sequence at position ", pos($content) - +length($sequence), "\n"; }
What did you want "pos($content) - length($sequence)" to give you? The whole pattern starts at 371 and ends at 428 while the contents of $1 start at 416 and end at 424 so 420 is somewhere in the middle of $1. Have a look at the @- and @+ arrays for the start and end positions of matches.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: need help with a regex
by kennethk (Abbot) on Oct 22, 2010 at 21:36 UTC |