re = /^(((0|[1-9]\d*)\.)(((0|[1-9]\d*|x)\.)?x)|main|next(-major)?|beta|alpha)$/m
str = 'Inspired by Semantic Release Distributions Channels from Branches: https://semantic-release.gitbook.io/semantic-release/usage/configuration#branches
Valid Semantic Release Distribution Channels:
0.0.x
0.x.x
0.x
1.2.x
1.x.x
1.x
10.20.x
10.x.x
10.x
1.0.x
2.0.x
2.x.x
2.x
1.1.x
99999999999999999999999.999999999999999999.x
99999999999999999999999.x.x
99999999999999999999999.x
main
next
next-major
beta
alpha
Inalid Semantic Release Distribution Channels:
x
0.
0.xx
00.0.x
1.2
01.x
1.02.x
1.x.0
x.20.x
x.x.x
x.0.x
2.0.x-alpha
2.0.x+meta
x.x
01.1.x
99999999999999999999999.0999999999999999999.x
099999999999999999999999.x.x
mains
pre-next
next-minor
beta+
-alpha
gamma
'
# Print the match result
str.scan(re) do |match|
puts match.to_s
end
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Ruby, please visit: http://ruby-doc.org/core-2.2.0/Regexp.html