People sometimes do things like this.
label_value = r'\w=-?\d{1,3}(\.\d{1,2})?' line = r'^C:{0}:{0}:{0};$'.format( label_value ) line_pat= re.compile( line )
This is a little smarter.
label_value = r'(\w)=(-?\d{1,3}(?:\.\d{1,2})?)' line = r'^C:{0}:{0}:{0};$'.format( label_value ) line_pat= re.compile( line )
Why? It collects the label and all floating point values, not just the digits to the right of the decimal point.
In the unlikely event that the order of the labels actually matters .
value = r'(-?\d{1,3}(?:\.\d{1,2})?)' line = r'^C:x={0}:y={0}:z={0};$'.format( value ) line_pat= re.compile( line )
This requires three labels in this order. One of those things that can change.
source share