How would I count the number of occurrences of a character – specifically, the ":" character – in the current system clipboard text, and then set that count to a variable?
Here is another possibility. Search and Replace everything that isn't a colon and remove it, and then count the remaining characters with the Filter action.
I know you've got it running, but here is a very simple way to do what you want.
It depends on understanding that the clipboard contents are, in KM terms, a variable array that uses the custom delimiter of a colon - ":". The KM wiki explains this in full here: manual:Variables [Keyboard Maestro Wiki]
Consequently counting the number of colons is simply the size of the array minus one like this:
They allow you to split a string on a delimiter, and refer to the resulting parts by numeric index.
[1] is the first part, and [0] stores a count of the total.
By default, KM assumes that the string is split into parts by commas,
but, as @tiffle has done here, you can specify a custom delimiter, placing it immediately after the closing ] – hence [0]: rather than plain [0]
As the number of delimiters is always one less than the total number of parts resulting from the split, @tiffle has wrapped the expression in CALCULATE, to perform a numeric (rather than string) operation, subtracting one from the number of delimited string parts.