diff --git a/src/pyEQL/utils.py b/src/pyEQL/utils.py index 358a179c..442b0336 100644 --- a/src/pyEQL/utils.py +++ b/src/pyEQL/utils.py @@ -54,7 +54,13 @@ def _translate_pint_quantity(amount: str): return amount.magnitude, str(amount.units) match = re.match(r"^\s*([+-]?\d*\.?\d+(?:[eE][+-]?\d+)?)\s*(.*)$", amount) + + if match is None: + return amount + _value, _unit = match.groups() + # handle python ** expression in Pint quantity + _value = eval(_value) if "**" in _value else float(_value) unit = translate_units(_unit) return (float(_value), unit)