{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/7530","labels_url":"https://api.github.com/repos/JuliaLang/julia/issues/7530/labels{/name}","comments_url":"https://api.github.com/repos/JuliaLang/julia/issues/7530/comments","events_url":"https://api.github.com/repos/JuliaLang/julia/issues/7530/events","html_url":"https://github.com/JuliaLang/julia/issues/7530","id":37233861,"number":7530,"title":"Regex comparison fails with `==` but string comparison does not?","user":{"login":"Aerlinger","id":604138,"avatar_url":"https://avatars.githubusercontent.com/u/604138?v=3","gravatar_id":"","url":"https://api.github.com/users/Aerlinger","html_url":"https://github.com/Aerlinger","followers_url":"https://api.github.com/users/Aerlinger/followers","following_url":"https://api.github.com/users/Aerlinger/following{/other_user}","gists_url":"https://api.github.com/users/Aerlinger/gists{/gist_id}","starred_url":"https://api.github.com/users/Aerlinger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Aerlinger/subscriptions","organizations_url":"https://api.github.com/users/Aerlinger/orgs","repos_url":"https://api.github.com/users/Aerlinger/repos","events_url":"https://api.github.com/users/Aerlinger/events{/privacy}","received_events_url":"https://api.github.com/users/Aerlinger/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2014-07-07T01:46:15Z","updated_at":"2015-09-15T21:50:39Z","closed_at":null,"body":"Regex comparison fails with `===` and `==`, for instance:\r\n\r\n```julia\r\n\"asdf\" == \"asdf\" #  => true\r\n\r\nr\"asdf\" == r\"asdf\" # => false\r\n```\r\n\r\nIt seems this is because Regex actually utilizes a pointer to representing the regex pattern and extra options, so identical regular expressions point to different locations in memory even if their value is identical. However, would it be safe to consider a Regex as a value object (Like string, date, currency, etc)? If so it might be worth defining a method for == that checks for equality based on the pattern and options of two Regex objects:\r\n\r\n```julia\r\n==(re1::Regex, re2::Regex) = (re1.pattern == re2.pattern && re1.options == re2.options)\r\n```\r\n\r\nAnd thus:\r\n```julia\r\nr\"asdf\" == r\"asdf\"  # => true\r\n```"},"comment":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/comments/140556901","html_url":"https://github.com/JuliaLang/julia/issues/7530#issuecomment-140556901","issue_url":"https://api.github.com/repos/JuliaLang/julia/issues/7530","id":140556901,"user":{"login":"pao","id":140497,"avatar_url":"https://avatars.githubusercontent.com/u/140497?v=3","gravatar_id":"","url":"https://api.github.com/users/pao","html_url":"https://github.com/pao","followers_url":"https://api.github.com/users/pao/followers","following_url":"https://api.github.com/users/pao/following{/other_user}","gists_url":"https://api.github.com/users/pao/gists{/gist_id}","starred_url":"https://api.github.com/users/pao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pao/subscriptions","organizations_url":"https://api.github.com/users/pao/orgs","repos_url":"https://api.github.com/users/pao/repos","events_url":"https://api.github.com/users/pao/events{/privacy}","received_events_url":"https://api.github.com/users/pao/received_events","type":"User","site_admin":false},"created_at":"2015-09-15T21:50:39Z","updated_at":"2015-09-15T21:50:39Z","body":"Is there a test for it? That commit didn't add one."}}