Is there a way to count characters using regular expressions

If you are trying to count the number of characters, then you do not want the +. This is what causes your match to create arrays of words instead of letters. Remember that \w+ means “one or more word-characters”. The match will therefore be a group of sequential alphanumerics. In other words, words.