<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def package_regex_filter(config, message, pattern=None, *args, **kw):
 """ All packages matching a regular expression Use this rule to include messages that relate to packages that match particular regular expressions (*i.e., (maven|javapackages-tools|maven-surefire)*). """


    pattern = kw.get('pattern', pattern)
    if pattern:
        packages = fmn.rules.utils.msg2packages(message, **config)
        regex = fmn.rules.utils.compile_regex(pattern.encode('utf-8'))
        return any([regex.search(p.encode('utf-8')) for p in packages])