KingTomato, thanks for your effort, but the alias you made isn't perfect because it (a) doesn't support multiple params as $count does, and (b) counts only single characters.
Another version that comes to my mind:
alias countcs {
var %c = 0, %i = 2, %p
while %i <= $0 {
!.echo -q $regsub($($ $+ %i,2),/([\.\(\)\{\}\+\*\?\[\]])/g,\\\1,%p)
var %c = %c + $regex($1,$+(/,%p,/g)), %i = %i + 1
}
return %c
}
Nimue, you're right. This could be done using regex as well as $removecs and $replacecs, but, for that the user will have to learn regex, and memorize which reserved characters need escaping. I think a built-in identifier will make life easier for everyone, and, as qwerty said, is expected for completing the case-sensitive series.
qwerty, I haven't seen $countcs mentioned before, that's why I brought it up here. If that thread wasn't too old, I'd just post it there, but I'm afraid no one reads it anymore.