Regular Expression String Length Function In Python