{"action":"created","comment":{"url":"https://api.github.com/repos/semver/semver/pulls/comments/213984156","pull_request_review_id":150936308,"id":213984156,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxMzk4NDE1Ng==","diff_hunk":"@@ -319,6 +319,20 @@ Abbreviating \"version\" as \"v\" is often seen with version control. Example:\n `git tag v1.2.3 -m \"Release version 1.2.3\"`, in which case \"v1.2.3\" is a tag\n name and the semantic version is \"1.2.3\".\n \n+### Is there a regular expression (RegEx) to check a SemVer string?\n+\n+There are two. One with named groups for those systems that support them:\n+\n+```\n+^(?<major>0|[1-9]\\d*)\\.(?<minor>0|[1-9]\\d*)\\.(?<patch>0|[1-9]\\d*)(?:-(?<prerelease>(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+(?<buildmetadata>[0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$\n+```\n+\n+And one with non-capturing groups instead (so cg1 = major, cg2 = minor,","path":"semver.md","position":null,"original_position":12,"commit_id":"a83e7155e4ade55430f9b44e0732fe5a1e4fed37","original_commit_id":"5e29beeab54e42725c39e41596599bc55ce4049f","user":{"login":"DavidFichtmueller","id":7805030,"node_id":"MDQ6VXNlcjc4MDUwMzA=","avatar_url":"https://avatars2.githubusercontent.com/u/7805030?v=4","gravatar_id":"","url":"https://api.github.com/users/DavidFichtmueller","html_url":"https://github.com/DavidFichtmueller","followers_url":"https://api.github.com/users/DavidFichtmueller/followers","following_url":"https://api.github.com/users/DavidFichtmueller/following{/other_user}","gists_url":"https://api.github.com/users/DavidFichtmueller/gists{/gist_id}","starred_url":"https://api.github.com/users/DavidFichtmueller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DavidFichtmueller/subscriptions","organizations_url":"https://api.github.com/users/DavidFichtmueller/orgs","repos_url":"https://api.github.com/users/DavidFichtmueller/repos","events_url":"https://api.github.com/users/DavidFichtmueller/events{/privacy}","received_events_url":"https://api.github.com/users/DavidFichtmueller/received_events","type":"User","site_admin":false},"body":"@jwdonahue well the non-named groups are just parentheses which are supported by pretty much every system except POSIX/GNU BRE/ERE according to [this site](https://www.regular-expressions.info/refcapture.html). One could argue for making one that doesn't use non-capturing groups, so the reference numbers will be different, but then again, according to the same site, this only effects ORACLE and XML. So I would just leave it as it is. In case some people raise this question at some point (which I highly doubt), we can further extend the FAQ. But leave it concise for now. ","created_at":"2018-08-30T10:44:34Z","updated_at":"2018-08-30T10:44:34Z","html_url":"https://github.com/semver/semver/pull/460#discussion_r213984156","pull_request_url":"https://api.github.com/repos/semver/semver/pulls/460","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/semver/semver/pulls/comments/213984156"},"html":{"href":"https://github.com/semver/semver/pull/460#discussion_r213984156"},"pull_request":{"href":"https://api.github.com/repos/semver/semver/pulls/460"}},"in_reply_to_id":213454256},"pull_request":{"url":"https://api.github.com/repos/semver/semver/pulls/460","id":210578157,"node_id":"MDExOlB1bGxSZXF1ZXN0MjEwNTc4MTU3","html_url":"https://github.com/semver/semver/pull/460","diff_url":"https://github.com/semver/semver/pull/460.diff","patch_url":"https://github.com/semver/semver/pull/460.patch","issue_url":"https://api.github.com/repos/semver/semver/issues/460","number":460,"state":"open","locked":false,"title":"FAQ: semver regex","user":{"login":"wolf99","id":281700,"node_id":"MDQ6VXNlcjI4MTcwMA==","avatar_url":"https://avatars2.githubusercontent.com/u/281700?v=4","gravatar_id":"","url":"https://api.github.com/users/wolf99","html_url":"https://github.com/wolf99","followers_url":"https://api.github.com/users/wolf99/followers","following_url":"https://api.github.com/users/wolf99/following{/other_user}","gists_url":"https://api.github.com/users/wolf99/gists{/gist_id}","starred_url":"https://api.github.com/users/wolf99/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wolf99/subscriptions","organizations_url":"https://api.github.com/users/wolf99/orgs","repos_url":"https://api.github.com/users/wolf99/repos","events_url":"https://api.github.com/users/wolf99/events{/privacy}","received_events_url":"https://api.github.com/users/wolf99/received_events","type":"User","site_admin":false},"body":"With regex by @DavidFichtmueller taken from https://github.com/semver/semver/issues/232","created_at":"2018-08-23T21:15:20Z","updated_at":"2018-08-30T10:44:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cd6033de6a087bece0b1193c6cc445884bb303ff","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/semver/semver/pulls/460/commits","review_comments_url":"https://api.github.com/repos/semver/semver/pulls/460/comments","review_comment_url":"https://api.github.com/repos/semver/semver/pulls/comments{/number}","comments_url":"https://api.github.com/repos/semver/semver/issues/460/comments","statuses_url":"https://api.github.com/repos/semver/semver/statuses/a83e7155e4ade55430f9b44e0732fe5a1e4fed37","head":{"label":"wolf99:regex-doc","ref":"regex-doc","sha":"a83e7155e4ade55430f9b44e0732fe5a1e4fed37","user":{"login":"wolf99","id":281700,"node_id":"MDQ6VXNlcjI4MTcwMA==","avatar_url":"https://avatars2.githubusercontent.com/u/281700?v=4","gravatar_id":"","url":"https://api.github.com/users/wolf99","html_url":"https://github.com/wolf99","followers_url":"https://api.github.com/users/wolf99/followers","following_url":"https://api.github.com/users/wolf99/following{/other_user}","gists_url":"https://api.github.com/users/wolf99/gists{/gist_id}","starred_url":"https://api.github.com/users/wolf99/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wolf99/subscriptions","organizations_url":"https://api.github.com/users/wolf99/orgs","repos_url":"https://api.github.com/users/wolf99/repos","events_url":"https://api.github.com/users/wolf99/events{/privacy}","received_events_url":"https://api.github.com/users/wolf99/received_events","type":"User","site_admin":false},"repo":{"id":145906453,"node_id":"MDEwOlJlcG9zaXRvcnkxNDU5MDY0NTM=","name":"semver","full_name":"wolf99/semver","owner":{"login":"wolf99","id":281700,"node_id":"MDQ6VXNlcjI4MTcwMA==","avatar_url":"https://avatars2.githubusercontent.com/u/281700?v=4","gravatar_id":"","url":"https://api.github.com/users/wolf99","html_url":"https://github.com/wolf99","followers_url":"https://api.github.com/users/wolf99/followers","following_url":"https://api.github.com/users/wolf99/following{/other_user}","gists_url":"https://api.github.com/users/wolf99/gists{/gist_id}","starred_url":"https://api.github.com/users/wolf99/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wolf99/subscriptions","organizations_url":"https://api.github.com/users/wolf99/orgs","repos_url":"https://api.github.com/users/wolf99/repos","events_url":"https://api.github.com/users/wolf99/events{/privacy}","received_events_url":"https://api.github.com/users/wolf99/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/wolf99/semver","description":"Semantic Versioning Specification","fork":true,"url":"https://api.github.com/repos/wolf99/semver","forks_url":"https://api.github.com/repos/wolf99/semver/forks","keys_url":"https://api.github.com/repos/wolf99/semver/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wolf99/semver/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wolf99/semver/teams","hooks_url":"https://api.github.com/repos/wolf99/semver/hooks","issue_events_url":"https://api.github.com/repos/wolf99/semver/issues/events{/number}","events_url":"https://api.github.com/repos/wolf99/semver/events","assignees_url":"https://api.github.com/repos/wolf99/semver/assignees{/user}","branches_url":"https://api.github.com/repos/wolf99/semver/branches{/branch}","tags_url":"https://api.github.com/repos/wolf99/semver/tags","blobs_url":"https://api.github.com/repos/wolf99/semver/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wolf99/semver/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wolf99/semver/git/refs{/sha}","trees_url":"https://api.github.com/repos/wolf99/semver/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wolf99/semver/statuses/{sha}","languages_url":"https://api.github.com/repos/wolf99/semver/languages","stargazers_url":"https://api.github.com/repos/wolf99/semver/stargazers","contributors_url":"https://api.github.com/repos/wolf99/semver/contributors","subscribers_url":"https://api.github.com/repos/wolf99/semver/subscribers","subscription_url":"https://api.github.com/repos/wolf99/semver/subscription","commits_url":"https://api.github.com/repos/wolf99/semver/commits{/sha}","git_commits_url":"https://api.github.com/repos/wolf99/semver/git/commits{/sha}","comments_url":"https://api.github.com/repos/wolf99/semver/comments{/number}","issue_comment_url":"https://api.github.com/repos/wolf99/semver/issues/comments{/number}","contents_url":"https://api.github.com/repos/wolf99/semver/contents/{+path}","compare_url":"https://api.github.com/repos/wolf99/semver/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wolf99/semver/merges","archive_url":"https://api.github.com/repos/wolf99/semver/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wolf99/semver/downloads","issues_url":"https://api.github.com/repos/wolf99/semver/issues{/number}","pulls_url":"https://api.github.com/repos/wolf99/semver/pulls{/number}","milestones_url":"https://api.github.com/repos/wolf99/semver/milestones{/number}","notifications_url":"https://api.github.com/repos/wolf99/semver/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wolf99/semver/labels{/name}","releases_url":"https://api.github.com/repos/wolf99/semver/releases{/id}","deployments_url":"https://api.github.com/repos/wolf99/semver/deployments","created_at":"2018-08-23T20:57:38Z","updated_at":"2018-08-23T20:57:39Z","pushed_at":"2018-08-29T20:31:26Z","git_url":"git://github.com/wolf99/semver.git","ssh_url":"git@github.com:wolf99/semver.git","clone_url":"https://github.com/wolf99/semver.git","svn_url":"https://github.com/wolf99/semver","homepage":"semver.org","size":66,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"semver:master","ref":"master","sha":"0310cdd5a19d0f6a280b3bd5b01122882b653c4d","user":{"login":"semver","id":8051653,"node_id":"MDEyOk9yZ2FuaXphdGlvbjgwNTE2NTM=","avatar_url":"https://avatars2.githubusercontent.com/u/8051653?v=4","gravatar_id":"","url":"https://api.github.com/users/semver","html_url":"https://github.com/semver","followers_url":"https://api.github.com/users/semver/followers","following_url":"https://api.github.com/users/semver/following{/other_user}","gists_url":"https://api.github.com/users/semver/gists{/gist_id}","starred_url":"https://api.github.com/users/semver/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/semver/subscriptions","organizations_url":"https://api.github.com/users/semver/orgs","repos_url":"https://api.github.com/users/semver/repos","events_url":"https://api.github.com/users/semver/events{/privacy}","received_events_url":"https://api.github.com/users/semver/received_events","type":"Organization","site_admin":false},"repo":{"id":1819245,"node_id":"MDEwOlJlcG9zaXRvcnkxODE5MjQ1","name":"semver","full_name":"semver/semver","owner":{"login":"semver","id":8051653,"node_id":"MDEyOk9yZ2FuaXphdGlvbjgwNTE2NTM=","avatar_url":"https://avatars2.githubusercontent.com/u/8051653?v=4","gravatar_id":"","url":"https://api.github.com/users/semver","html_url":"https://github.com/semver","followers_url":"https://api.github.com/users/semver/followers","following_url":"https://api.github.com/users/semver/following{/other_user}","gists_url":"https://api.github.com/users/semver/gists{/gist_id}","starred_url":"https://api.github.com/users/semver/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/semver/subscriptions","organizations_url":"https://api.github.com/users/semver/orgs","repos_url":"https://api.github.com/users/semver/repos","events_url":"https://api.github.com/users/semver/events{/privacy}","received_events_url":"https://api.github.com/users/semver/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/semver/semver","description":"Semantic Versioning Specification","fork":false,"url":"https://api.github.com/repos/semver/semver","forks_url":"https://api.github.com/repos/semver/semver/forks","keys_url":"https://api.github.com/repos/semver/semver/keys{/key_id}","collaborators_url":"https://api.github.com/repos/semver/semver/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/semver/semver/teams","hooks_url":"https://api.github.com/repos/semver/semver/hooks","issue_events_url":"https://api.github.com/repos/semver/semver/issues/events{/number}","events_url":"https://api.github.com/repos/semver/semver/events","assignees_url":"https://api.github.com/repos/semver/semver/assignees{/user}","branches_url":"https://api.github.com/repos/semver/semver/branches{/branch}","tags_url":"https://api.github.com/repos/semver/semver/tags","blobs_url":"https://api.github.com/repos/semver/semver/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/semver/semver/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/semver/semver/git/refs{/sha}","trees_url":"https://api.github.com/repos/semver/semver/git/trees{/sha}","statuses_url":"https://api.github.com/repos/semver/semver/statuses/{sha}","languages_url":"https://api.github.com/repos/semver/semver/languages","stargazers_url":"https://api.github.com/repos/semver/semver/stargazers","contributors_url":"https://api.github.com/repos/semver/semver/contributors","subscribers_url":"https://api.github.com/repos/semver/semver/subscribers","subscription_url":"https://api.github.com/repos/semver/semver/subscription","commits_url":"https://api.github.com/repos/semver/semver/commits{/sha}","git_commits_url":"https://api.github.com/repos/semver/semver/git/commits{/sha}","comments_url":"https://api.github.com/repos/semver/semver/comments{/number}","issue_comment_url":"https://api.github.com/repos/semver/semver/issues/comments{/number}","contents_url":"https://api.github.com/repos/semver/semver/contents/{+path}","compare_url":"https://api.github.com/repos/semver/semver/compare/{base}...{head}","merges_url":"https://api.github.com/repos/semver/semver/merges","archive_url":"https://api.github.com/repos/semver/semver/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/semver/semver/downloads","issues_url":"https://api.github.com/repos/semver/semver/issues{/number}","pulls_url":"https://api.github.com/repos/semver/semver/pulls{/number}","milestones_url":"https://api.github.com/repos/semver/semver/milestones{/number}","notifications_url":"https://api.github.com/repos/semver/semver/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/semver/semver/labels{/name}","releases_url":"https://api.github.com/repos/semver/semver/releases{/id}","deployments_url":"https://api.github.com/repos/semver/semver/deployments","created_at":"2011-05-29T23:10:40Z","updated_at":"2018-08-30T09:25:54Z","pushed_at":"2018-08-29T20:31:28Z","git_url":"git://github.com/semver/semver.git","ssh_url":"git@github.com:semver/semver.git","clone_url":"https://github.com/semver/semver.git","svn_url":"https://github.com/semver/semver","homepage":"semver.org","size":61,"stargazers_count":3522,"watchers_count":3522,"language":null,"has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":427,"mirror_url":null,"archived":false,"open_issues_count":122,"license":null,"forks":427,"open_issues":122,"watchers":3522,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/semver/semver/pulls/460"},"html":{"href":"https://github.com/semver/semver/pull/460"},"issue":{"href":"https://api.github.com/repos/semver/semver/issues/460"},"comments":{"href":"https://api.github.com/repos/semver/semver/issues/460/comments"},"review_comments":{"href":"https://api.github.com/repos/semver/semver/pulls/460/comments"},"review_comment":{"href":"https://api.github.com/repos/semver/semver/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/semver/semver/pulls/460/commits"},"statuses":{"href":"https://api.github.com/repos/semver/semver/statuses/a83e7155e4ade55430f9b44e0732fe5a1e4fed37"}},"author_association":"NONE"}}
{"actor":{"display_login":"DavidFichtmueller"}}