Create a regular expression with all keywords used in the database. The $filter is optional and should be a code reference accepting the keyword as first parameter and return a boolean value for acceptance.