For most of my life I’ve had the habit of tapping my fingers when I’m thinking/nervous/fidgety, which is a lot. Besides playing along to whatever song is in my head, I’ve also gone through a few phases exploring different tapping sequences.

The first I can remember is from elementary school, trying to find the optimal sequence one-handed taps (if you’re curious, it’s index - ring - pinky - middle - thumb). Then I must have learned some math, because I have a pretty clear memory of working through some modular division in one of my (many, painful) childhood dentist appointments.

For the last few decades(!), maybe since I started typing, I’ve been on a quest to find words that can be spelled using each finger only once. And until earlier today, using trial and error, I had only ever found one: pleasing.

The code

In retrospect, this is a problem that I could have solved at any time since learning to program in college. But my quest, the origins of which predate that knowledge, has somehow remained locked in its own domain, even as I’ve tried to solve every other problem with code. The challenge I put to myself today was not just to find a solution, but to do it with a regex one-liner.

First, I played around with some Python, using the Unix words file:

import re

if __name__ == '__main__':
    # https://stackoverflow.com/a/3533526/4938355
    p = re.compile('^(?=.{8}$)(?=.*[aqz])(?=.*[swx])(?=.*[de])(?=.*[bcfgrtv])(?=.*[hjmnuy])(?=.*[ik])(?=.*[lo])(?=.*[p]).+$')

    words = open('/usr/share/dict/words', 'r')
    for w in words:
        m = p.match(w)
        if m:
            print m.group()

Then, the one-liner in Perl:

perl -ne 'while(/^(?=.{8}$)(?=.*[aqz])(?=.*[swx])(?=.*[de])(?=.*[bcfgrtv])(?=.*[hjmnuy])(?=.*[ik])(?=.*[lo])(?=.*[p]).+$/g){print "$&\n";}' /usr/share/dict/words

The words

And finally, I present the definitive list of words that can be typed on a QWERTY keyboard using each finger only once:

biplanes
canopies
elapsing
esophagi
harelips
lifespan
misplace
palmiest
panelist
pelicans
plainest
plaudits
pleasing
poniards
pralines

This must be how Turing felt when he cracked the Enigma. On to the next tapping challenge

Addendum

After showing this to a few coworkers, I was surprised to learn that people use different fingers for certain keys. Specifically, there seems to be a debate about whether the left index or middle finger is responsible for c.

Even though the answer is obvious, I figured it would be easy enough to implement the search in JavaScript. Two (needlessly complicated) hours of programming later…