amit hetawal wrote:
> 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.
I'd do something like:
use strict;
use warnings;
my $temp = 'XXXXAAAZZZZBBBSSSSCCCGGGGBBBVVVVVBBB';
while ($temp =~ s/((?:AAA|BBB|CCC).*?(AAA|BBB|CCC))/$2/) {
# $2 - leave the suffix there for next piece
print "piece=$1\n";
}
__END__
piece=AAAZZZZBBB
piece=BBBSSSSCCC
piece=CCCGGGGBBB
piece=BBBVVVVVBBB
>
> $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.
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs