import re
numeric_regex = r'''
                [-+]?                    # pos or neg
                (?:
                  \d*\.\d+               # float (ie .1 and 1.1)
                  | 
                  \d+ \.?                # int (with trailing periods ie 1.)
                )'''

default_regex = rf'''
                \|.*?                    #  | and 0+ whitespaces
                ({numeric_regex})        # Capturing group: all digits
                $                        # end of the string
'''
logic = 'xxx -> 31223.1 | xxx 1.1'
m = re.search(default_regex, logic, re.VERBOSE)
if m:
	print(m.group(1))