Although this may occasionally work for you in this circumstance, it's not logical to modify the original string just to count the number of occurrences. Just use /\S+/g instead.
In reply to Re^3: Counting the number of items returned by split without using a named array
by blazar
in thread Counting the number of items returned by split without using a named array
by Anonymous Monk
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |