Cantello has asked for the wisdom of the Perl Monks concerning the following question:
The output is:my $a = "AAAAXRXAAAAAXKXAAAAAXRPXAAA" # sample sequence @digested0 = split(/[KR](?!P)/, $orf); # cut at every K or R, except i +f followed by a P print join("\n",@digested0);
It's basically correct but it should beAAAAX XAAAAAX XAAAAAXRPXAAA
i.e. keeping the separator "K" or "R". How could I achieve this? There probably is a regexp for that as well, I'm just too blind to find it... Thanks! :-)AAAAXR XAAAAAXK XAAAAAXRPXAAA
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Splitting string (regex) while keeping the separator?
by moritz (Cardinal) on May 03, 2010 at 14:08 UTC | |
|
Re: Splitting string (regex) while keeping the separator?
by AnomalousMonk (Archbishop) on May 03, 2010 at 16:04 UTC | |
|
Re: Splitting string (regex) while keeping the separator?
by Anonymous Monk on May 03, 2010 at 14:50 UTC | |
|
Re: Splitting string (regex) while keeping the separator?
by Sinistral (Monsignor) on May 03, 2010 at 20:17 UTC | |
by Cantello (Novice) on May 04, 2010 at 05:45 UTC | |
|
Re: Splitting string (regex) while keeping the separator?
by Anonymous Monk on May 03, 2010 at 14:09 UTC |