attr: avoid strlen() on every match