5 added 51 characters in body

# Ruby, 1378782766767 55 bytes

Ungolfed, but you can see the pattern.

gets$><<gets.chars{|c|$><<gsub(c=~/\w[a-z0-9]/?((c<?A??0:c>?Z??a:?Ai){[*" 0Aa"[$&.ord/32].c).inject(:+):c)$&]*""}


Edit: golfed down to only one regex.

Edit 2: had a lot of extra spaces.

Edit 3: Thanks to manatwork for golfing 12 bytes!

# Ruby, 13787827667 bytes

Ungolfed, but you can see the pattern.

gets.chars{|c|$><<(c=~/\w/?((c<?A??0:c>?Z??a:?A)..c).inject(:+):c)}  Edit: golfed down to only one regex. Edit 2: had a lot of extra spaces. # Ruby, 13787827667 55 bytes Ungolfed, but you can see the pattern. $><<gets.gsub(/[a-z0-9]/i){[*" 0Aa"[$&.ord/32]..$&]*""}


Edit: golfed down to only one regex.

Edit 2: had a lot of extra spaces.

Edit 3: Thanks to manatwork for golfing 12 bytes!

4 added 1 character in body

# Ruby, 13787827676 67 bytes

Ungolfed, but you can see the pattern.

gets.chars{|c|$><<(c=~/[A-Za-z0-9]\w/?((c<?A??0:c>?Z??a:?A)..c).inject(:+):c)}  Edit: golfed down to only one regex. Edit 2: had a lot of extra spaces. # Ruby, 137878276 bytes Ungolfed, but you can see the pattern. gets.chars{|c|$><<(c=~/[A-Za-z0-9]/?((c<?A??0:c>?Z??a:?A)..c).inject(:+):c)}


Edit: golfed down to only one regex.

Edit 2: had a lot of extra spaces.

# Ruby, 137878276 67 bytes

Ungolfed, but you can see the pattern.

gets.chars{|c|$><<(c=~/\w/?((c<?A??0:c>?Z??a:?A)..c).inject(:+):c)}  Edit: golfed down to only one regex. Edit 2: had a lot of extra spaces. 3 added 42 characters in body # Ruby, 137878282 76 bytes Ungolfed, but you can see the pattern. gets.chars{|c|$><<(c=~/[A-Za-z0-9]/ ? ((c<?A ? ?0:c>?Z ? ?a:?A)..c).inject(:+):c)}


Edit: golfed down to only one regex.

Edit 2: had a lot of extra spaces.

# Ruby, 1378782 bytes

Ungolfed, but you can see the pattern.

gets.chars{|c|$><<(c=~/[A-Za-z0-9]/ ? ((c<?A ? ?0:c>?Z ? ?a:?A)..c).inject(:+):c)}  Edit: golfed down to only one regex. # Ruby, 1378782 76 bytes Ungolfed, but you can see the pattern. gets.chars{|c|$><<(c=~/[A-Za-z0-9]/?((c<?A??0:c>?Z??a:?A)..c).inject(:+):c)}


Edit: golfed down to only one regex.

Edit 2: had a lot of extra spaces.

2 added 5 characters in body
1