Updated regex to accept trailing slashes