improved regex to get AuthenticityToken
restored unit tests