in reply to Re: Splitting only on internal pattern, not at start or end of string
in thread Splitting only on internal pattern, not at start or end of string

That is totally awesome, many thanks!
  • Comment on Re^2: Splitting only on internal pattern, not at start or end of string

Replies are listed 'Best First'.
Re^3: Splitting only on internal pattern, not at start or end of string
by johngg (Canon) on Jan 16, 2014 at 10:08 UTC

    Unfortunately, also totally wrong as it will consume an A, C, G or T adjacent to the Ns. Rather than split do a global match for one or more of A, C, G or T.

    $ perl -E ' $seq = q{NNACGTNNNACGTNACGTNN}; say for split m{[ACGT]N+[ACGT]}, $seq; say q{-} x 10; say for $seq =~ m{[ACGT]+}g;' NNACG CG CGTNN ---------- ACGT ACGT ACGT $

    I hope this is helpful.

    Update: Corrected wording, s/more than one of/one or more of/

    Cheers,

    JohnGG