How many characters are there on the icon of a Stack Exchange site?

CJam, 50 48 45 bytes

l22b391"þÁ "+{i%}/"Yª>Þÿ9cîÂcVáòe~"322b4b=

There's unprintable characters in the strings above, which can be obtained by the snippets

[254 193 160]:c
[89 170 62 222 30 255 20 57 99 238 194 99 86 225 242 101 126 20]:c

This also shows that the code points are all below 256. Output is 0 for 1 letter, 1 for 2 letters, 2 for 3 letters and 3 for non-ASCII.

The program simply converts the input string to a base 22 number, performs a series of modulos to reduce the number down, before performing a lookup from a base-4 encoded table.

Try it online | Test suite


Retina, 146 136 134 130 124 107 102 bytes

A\w*i|Che|CR|ke
4
my|Be|lan|^H.*y$|lt|aw|:|Pa|Ou|Wr
1
gn.|^e|Et|^H.*S|gui|rc|lf|To
2
.*(\d).*
$1
..+
3

Thanks @Sp3000 for golfing off 4 bytes!
Thanks @Mwr247 for golfing off 17 bytes by letting me use regexes from his answer!
Thanks @jimmy23013 for golfing off 5 bytes by reminding me that I can change output values!

The output is 1, 3, 2, and 4 for 1-char, 2-char, 3-char, and non-ASCII, respectively.

Version with all testcases has edits in few places to make it work with multiple lines.

Try it online!
Try it online with all testcases!


Javscript ES6, 342 339 330 327 bytes

a=>{for(c of "9As4BebFr6He7Hi3LaoMu9PaiTh7Wrzb3DdAmlBi7BiiBo8BugCh6CoiColCohCocDadEa6Eb9Ec5EmbEnbExfFrnGaqGefGeoHa8HibHo5IsgIthJa6Jo9LicMalMayMoaMu9My9OplPe4PeaPhgPh8PojPoiPr8PukQujRe8RogRu10SooSocSohSpgSp6Sp8StiSu7TraVigVidWibWodWoziCodel8EtyHibLibOpvPrhSi3To".split`z`)if(~c.indexOf(a.length.toString(36)+a[0]+a[1]))return c}

Returns a long string starting with 9 for one character, a different long string starting with b for two, a third string starting withi for three, and simply undefined for non-ascii.