Replace the regexp checking ID validity with a function. The benefits are: - function is faster (up to 10x faster with less allocations); - no init overhead to compile the regexp; Add a test case. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>