How to extract error detail from traceback by using python regex?

Solution 1:

If I change your pattern to Traceback.*\n(\s+.*\n)*(.*?)\n* it works for the given example. I am not sure though, that it solves your problem completely.