Use common regex functions in client
Tidy up initialisation in doregex.c