# Matching any series of decimals is deceptively complicated (?\-)? # It might be start with a - (?:(?> # Then it can be either: (?\d+) # One or more digits (the Characteristic) (?:\.(?\d+)){0,1} # followed by a period and one or more digits (the Mantissa) | # Or it can be (?:\.(?\d+)) # just a Mantissa )) (?: E (? [+-]\d+ ) )?