improved regexp filtering