Efficient multi-profile filtering using finite automata