added ~ to allowed characters in uri pattern