Generalized integer casting in Python
Python 2, 47, 46
It's not as short as using regex, but I thought it was entertainingly obscure.
i=int(('0%sx'%s)[:~len(s.lstrip(str(1&lt;&lt;68)))])

-1 due to KSab – str with some large integer works better than the repr operator since it does not put an L on the end.