Boetsie has asked for the wisdom of the Perl Monks concerning the following question:
Dear monks,
i have some large strings with character 'N' within it, the patterns are like;
xxxxxxxNNNNNxxxxxNxxxxNNNNNNNNxxx
xxNxxxNNNNNNNNNxxxxxx
etc...For each string, i want the number of consecutive N's. So for the first string I want the numbers 5, 1 and 8. The second string I want the numbers 1 and 9.
Anyone knows how to do this?
Cheers, Marten
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: count consecutive characters
by moritz (Cardinal) on Jun 07, 2010 at 08:38 UTC | |
|
Re: count consecutive characters
by johngg (Canon) on Jun 07, 2010 at 09:28 UTC | |
|
Re: count consecutive characters
by Boetsie (Sexton) on Jun 07, 2010 at 09:54 UTC |