update regex to exclude the trailing slash