Closed gg closed 5 years ago
The recent commit for #30 introduced a bug: _get_numeric returns 0 if the string doesn't contain 'st' or 'lb' units (e.g. _get_numeric('120') returns 0).
_get_numeric
0
_get_numeric('120')
This occurs because the BRITISH_UNIT_MATCHER regex matches any string.
BRITISH_UNIT_MATCHER
One way to fix this is to change the regex to only match strings that contain 'st':
(?:(?P<st>\d+) st)\W*(?:(?P<lbs>\d+) lb)?
You can test the regex here: https://regex101.com/r/HbAEZi/1
Whoops; good call.
Fixed as part of 1.13.3!
The recent commit for #30 introduced a bug:
_get_numeric
returns0
if the string doesn't contain 'st' or 'lb' units (e.g._get_numeric('120')
returns0
).This occurs because the
BRITISH_UNIT_MATCHER
regex matches any string.One way to fix this is to change the regex to only match strings that contain 'st':
You can test the regex here: https://regex101.com/r/HbAEZi/1