Regular Expression String Length Function Python