{"action":"closed","issue":{"url":"https://api.github.com/repos/pillarjs/path-to-regexp/issues/70","repository_url":"https://api.github.com/repos/pillarjs/path-to-regexp","labels_url":"https://api.github.com/repos/pillarjs/path-to-regexp/issues/70/labels{/name}","comments_url":"https://api.github.com/repos/pillarjs/path-to-regexp/issues/70/comments","events_url":"https://api.github.com/repos/pillarjs/path-to-regexp/issues/70/events","html_url":"https://github.com/pillarjs/path-to-regexp/issues/70","id":136241482,"number":70,"title":"Regex with starting optional group after forward slash gives error","user":{"login":"clshortfuse","id":9271155,"avatar_url":"https://avatars.githubusercontent.com/u/9271155?v=3","gravatar_id":"","url":"https://api.github.com/users/clshortfuse","html_url":"https://github.com/clshortfuse","followers_url":"https://api.github.com/users/clshortfuse/followers","following_url":"https://api.github.com/users/clshortfuse/following{/other_user}","gists_url":"https://api.github.com/users/clshortfuse/gists{/gist_id}","starred_url":"https://api.github.com/users/clshortfuse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clshortfuse/subscriptions","organizations_url":"https://api.github.com/users/clshortfuse/orgs","repos_url":"https://api.github.com/users/clshortfuse/repos","events_url":"https://api.github.com/users/clshortfuse/events{/privacy}","received_events_url":"https://api.github.com/users/clshortfuse/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-02-25T01:08:00Z","updated_at":"2016-02-26T00:32:24Z","closed_at":"2016-02-26T00:32:24Z","body":"I'm using express which uses path-to-regexp for URL routing.\r\n\r\nIf I use the following regex: \r\n\r\n    '/(apple-)?icon-:res(\\\\d+)x\\\\2.png'\r\n\r\nI get the following error:\r\n\r\n    Invalid regular expression: /^\\/(?(?:([^\\/]+?))-)?icon-(?:(\\d+))x\\2\\.png\\/?$/: Invalid group\r\n\r\nUsing escaped forward slash still gives an Invalid group error\r\n\r\nBreaking it down to just\r\n\r\n    '/(apple-)?'\r\n\r\ngives\r\n\r\n    /^\\/(?(?:([^\\/]+?))-)?\\/?$/: Invalid group\r\n\r\nMy current workaround is to do the following: \r\n\r\n    '/?(apple-)?icon-:res(\\\\d+)x\\\\2.png'\r\n\r\n\r\n\r\n"}}