Skip to content

Commit

Permalink
Merge pull request #108 from INTI-CMNB/space_before_units
Browse files Browse the repository at this point in the history
Add support for spaces between a value an its unit.
  • Loading branch information
SchrodingersGat committed Jul 18, 2020
2 parents 72818b6 + 6b96a8e commit 22a35a1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions kibom/units.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,14 @@ def groupString(group): # Return a reg-ex string for a list of values


def matchString():
return "^([0-9\.]+)(" + groupString(PREFIX_ALL) + ")*(" + groupString(UNIT_ALL) + ")*(\d*)$"
return r"^([0-9\.]+)\s*(" + groupString(PREFIX_ALL) + ")*(" + groupString(UNIT_ALL) + r")*(\d*)$"


def compMatch(component):
"""
Return a normalized value and units for a given component value string
e.g. compMatch("10R2") returns (10, R)
e.g. compMatch("3.3mOhm") returns (0.0033, R)
e.g. compMatch('10R2') returns (10, R)
e.g. compMatch('3.3mOhm') returns (0.0033, R)
"""

# Convert the decimal point from the current locale to a '.'
Expand Down

0 comments on commit 22a35a1

Please sign in to comment.