Parses a user-entered expression and ensures that mathematical integrity is retained upon substring rearrangement