def regex(value='', pattern='', ignorecase=False, multiline=False, match_type='search'):
 flags = 0
 if ignorecase:
  flags |= re.I
 if multiline:
  flags |= re.M
 _re = re.compile(pattern, flags=flags)
 _bool = __builtins__.get('bool')
 return _bool(getattr(_re, match_type, 'search')(value))

def regex ( value = '' , pattern = '' , ignorecase = False , multiline = False , match_type = 'search' ) : flags = 0 if ignorecase : flags |= re . I if multiline : flags |= re . M _re = re . compile ( pattern , flags = flags ) _bool = __builtins__ . get ( 'bool' ) return _bool ( getattr ( _re , match_type , 'search' ) ( value ) )
expose re as a boolean filter using the search method by default .