Hi Amit,
Here's my solution:
my $dna = 'XXXXAAAZZZZBBBSSSSCCCGGGGBBBVVVVVBBB';
my @tags = ('AAA',
'BBB',
'CCC',
);
my $tags = join "|", @tags;
my $tag_pattern = qr($tags);
print $_,"\n" foreach ( $dna =~ /(?=($tag_pattern.*?$tag_pattern))/g );
Output is:
AAAZZZZBBB
BBBSSSSCCC
CCCGGGGBBB
BBBVVVVVBBB
This should work for whatever pattern you specify in @tags list.
Regards,
Sam Dela Cruz
__________________________________________________________
Business Applications, Application Developer
AMEC Operations Management - North America
[EMAIL PROTECTED] wrote on 03/02/2007 01:54:26
PM:
> hello,
> Thanks for your previous reponses.
> Now this time i am using the right syntax for matching, for the string
like:
>
>
> $temp= "XXXXAAAZZZZBBBSSSSCCCGGGGBBBVVVVVBBB"
>
> I need to write a regex for filterin out the string between.
>
> AAA
> BBB
> CCC
>
> so in the above case i should have the output as:
>
>
> AAAZZZZZBBB
> BBBSSSSSSCCC
> CCCGGGGBBB
> BBBVVVVVBBB
> meaning all combinations of start and end for AAA BBB CCC.
>
> I have the regex for one of them but how do i do it simultaneously for
> all 3 of them.
>
>
> $temp='XXXXAAAZZZZBBBSSSSCCCGGGGBBBVVVVVBBB';
>
> @t = ($temp =~/(AAA)(.*?)(BBB)/g);
> foreach (@t)
> {
>
> print $_;
>
> }
>
> Am not able to figure out how will go about when just after the match
> i need to match for
> BBBSSSSCCC.
>
> Any suggestions
>
>
> Thanks
> _______________________________________________
> ActivePerl mailing list
> [email protected]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs