def regexp_extract(pattern, method=re.match, group=1):
 def regexp_extract_lambda(value):
  if (not value):
   return None
  matches = method(pattern, value)
  if (not matches):
   return None
  return matches.group(group)
 return regexp_extract_lambda

def regexp_extract ( pattern , method = re . match , group = 1 ) : def regexp_extract_lambda ( value ) : if ( not value ) : return None matches = method ( pattern , value ) if ( not matches ) : return None return matches . group ( group ) return regexp_extract_lambda
return first group in the value matching the pattern using re .