Some regex warning fixes

When compiling the internal regex code, gcc emits a lot of warnings about unused parameter and signed/unsigned comparison/assignment. The changes contained in this PR aim to fix them. The latter is done using casts in order to be less intrusive.