For each string that you'd run the regular expression to match '\n' character on, it should cost you O(N) in CPU time (for just matching this character), where N is the total number of characters in the string. Then it would cost O(1) each time the counter variable is incremented.
Note, this CPU time is based on the 'Big O' notation.
In reply to Re: Char counting
by sumeetgrover
in thread Char counting
by dd-b
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |