The 'magic' is in the (?{ ... }) construct. This allows you to insert perl into your regexen.use re 'eval'; my $seq = 'xxxTATAATGyyyTatAtAtzzz'; my $box = qr{ (?i) TATA [TA] [TA] [TAG] }xms; ;; my @TATAs; my @matches = $seq =~ m{ ($box) (?{ push @TATAs,[$+,pos() - length $+] }) }msxg; print "matched '$_->[0]' at pos $_->[1]\n" for @TATAs;
In reply to Re: positions of multiple matches
by mrstlee
in thread positions of multiple matches
by Anonymous Monk
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |