def extract_data2(s):
    pattern = re.compile(
        """\\|\\s*                 # opening bar and whitespace
                             '(?P<name>.*?)'       
                             \\s*\\|\\s*(?P<n1>.*?)   
                             \\s*\\|\\s*(?P<n2>.*?)   
                             \\s*\\|"""
        , re.VERBOSE)
match = pattern.match(s)
name = match.group('name')
n1 = float(match.group('n1'))
n2 = float(match.group('n2'))
return name, n1, n2
Python Regex to Parse String and Return Tuple