I asked a question about how to work around an error : https://stackoverflow.com/questions/32113109/check-if-a-named-capture-group-was-found
While I waited for an answer, I played around my code, the error disappeared, my original code works. Wonders. Or maybe I had a typo in the original code, who knows.
Meanwhile, answers were made to not encounter that error. The answers are interesting, but the error actually doesn't happen. So I don't know if I should accept one of the answers, ask the moderators for deletion (can't delete it myself since it has answers) or something else ?