made separate isKeyArray function and regex constant