Make regexp check more clear and documented