in reply to regex for word puzzle

If you really want to go with regexes, this will give you a general idea of how it would be done:

TPJ regex article by japhy

-- ank