Simplified regexp, and suggestions for clearer regexps.

As suggested in https://github.com/ipython/ipython/commit/3096afa2d4c749c6c70bae7c38536e02c287d56d#commitcomment-3533644, I removed a superfluous regexp part.

I also added suggestions about the way I would write things, that I find would make the code more legible and more explicit.