I like using regexes. I wrote one that, when used on regex101.com, makes pretty pictures like the ones below. It's a different color theme, but it helps show the idea off. It's also fairly simple, and there are a few edge cases that aren't handled, but it works well enough in most cases.
You need to have the markdown for code to be detected. You also need to use the gmi
modifiers. But you can easily test on your own this way. I haven't had the opportunity to analyze much, but I'd be interested in any patterns you find.
Regex with named groups:
(?<code> .*|`[^`]+`)|(?<vowels>[aeiou]+)|(?<punctuation>[[:punct:]]+)|(?<consonants>[bcdfghjklmnp-tv-z]+)|(?<spaces>\s)|(?<digits>\d+)
Same regex without named groups:
( .*|`[^`]+`)|([aeiou]+)|([[:punct:]]+)|([bcdfghjklmnp-tv-z]+)|(\s)|(\d+)
Pictures:
Your question:
One of my SO answers (this answer only has +5 score, which is the highest I've gotten on SO... Consider voting for my answers on SO if you like my regex here):
A random question scoring -5 on Stack Overflow: