regex implementation from musl.