Python regex match space but remove from grouping

noobsarenew

New Member
Given the following lines of XML:-\[code\]<tmpr>10.85</tmpr><sensor>01</sensor><ch1><watts>1000</watts></ch1><tmpr>-1.85</tmpr><sensor>01</sensor><ch1><watts>1000</watts></ch1>\[/code\]I can use the following Python Regular Expression to match three capturing groups:-\[code\]<tmpr>*([\-\d.]+)</tmpr>.*<sensor>(\d+)</sensor>.*<ch1><watts>0*(\d+)</watts></ch1>\[/code\]The problem is, when the temperature drops below 10.00 the XML introduces a leading space:-\[code\]<tmpr> 9.85</tmpr><sensor>01</sensor><ch1><watts>1000</watts></ch1>\[/code\]How could I modify the Regular Expression to capture the temperature but ignore the leading space ?
 
Back
Top