{"action":"created","issue":{"url":"https://api.github.com/repos/sharplet/Regex/issues/36","labels_url":"https://api.github.com/repos/sharplet/Regex/issues/36/labels{/name}","comments_url":"https://api.github.com/repos/sharplet/Regex/issues/36/comments","events_url":"https://api.github.com/repos/sharplet/Regex/issues/36/events","html_url":"https://github.com/sharplet/Regex/pull/36","id":130266534,"number":36,"title":"Convert `Regex.init` to a failable intialiser","user":{"login":"sharplet","id":147686,"avatar_url":"https://avatars.githubusercontent.com/u/147686?v=3","gravatar_id":"","url":"https://api.github.com/users/sharplet","html_url":"https://github.com/sharplet","followers_url":"https://api.github.com/users/sharplet/followers","following_url":"https://api.github.com/users/sharplet/following{/other_user}","gists_url":"https://api.github.com/users/sharplet/gists{/gist_id}","starred_url":"https://api.github.com/users/sharplet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sharplet/subscriptions","organizations_url":"https://api.github.com/users/sharplet/orgs","repos_url":"https://api.github.com/users/sharplet/repos","events_url":"https://api.github.com/users/sharplet/events{/privacy}","received_events_url":"https://api.github.com/users/sharplet/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-02-01T06:09:02Z","updated_at":"2016-02-01T09:20:21Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/sharplet/Regex/pulls/36","html_url":"https://github.com/sharplet/Regex/pull/36","diff_url":"https://github.com/sharplet/Regex/pull/36.diff","patch_url":"https://github.com/sharplet/Regex/pull/36.patch"},"body":"As discussed in #32, a failable initialiser is a good balance between convenience and safety. Previously, however, you'd at least get the failure reason printed to the console upon crashing. So this PR exposes a new static property `Regex.error` that will return the underlying error if a failure occurred during initialisation.\n\nFixes #32."},"comment":{"url":"https://api.github.com/repos/sharplet/Regex/issues/comments/177871269","html_url":"https://github.com/sharplet/Regex/pull/36#issuecomment-177871269","issue_url":"https://api.github.com/repos/sharplet/Regex/issues/36","id":177871269,"user":{"login":"klaaspieter","id":98880,"avatar_url":"https://avatars.githubusercontent.com/u/98880?v=3","gravatar_id":"","url":"https://api.github.com/users/klaaspieter","html_url":"https://github.com/klaaspieter","followers_url":"https://api.github.com/users/klaaspieter/followers","following_url":"https://api.github.com/users/klaaspieter/following{/other_user}","gists_url":"https://api.github.com/users/klaaspieter/gists{/gist_id}","starred_url":"https://api.github.com/users/klaaspieter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/klaaspieter/subscriptions","organizations_url":"https://api.github.com/users/klaaspieter/orgs","repos_url":"https://api.github.com/users/klaaspieter/repos","events_url":"https://api.github.com/users/klaaspieter/events{/privacy}","received_events_url":"https://api.github.com/users/klaaspieter/received_events","type":"User","site_admin":false},"created_at":"2016-02-01T09:20:21Z","updated_at":"2016-02-01T09:20:21Z","body":"Pod lint appears to fail on Travis.\r\n\r\nThe example become a bit more noisy with `!` everywhere, but it's probably the safest and most Swift-like approach :+1: . It's still possible to initialize a regex like this right? \r\n\r\n`let regex: Regex = Regex(\"*\")`\r\n\r\nThe reason I ask is because all the examples have been updated to forcibly unwrap optionals, while your explanation suggests that you should use the optional initializer if the regex string is not static, i.e. cannot be trusted.\r\n\r\nLooks good otherwise.\r\n\r\n"}}