re = /^(?:origin\/develop|origin\/master|origin\/release\/\d+\.\d+\.\d+(?!.)|origin\/release\/\d+\.\d+\.\d+(?:_uat|_preprod))$/m
str = 'origin/release/0.0.0_uat
origin/master
feature
origin/feature/0.0.0
origin/develop
dev
origin/release/0.0.0
origin/release
origin/release/0_0_0
origin/release/0/0/0
origin/release/0.0.0_preprod
'
# 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