Allow character classes in attribute patterns.

Fixes #3706