re = /\W+注册单位:\W+注册编号\/执业印章号:(\W|\d)+注册专业:\W+有效期:\d+年\d+月\d+日/m
str = '一级注册建造师
注册单位:
云南移民产业投融资有限公司
注册编号/执业印章号:
云1532018201900531
注册专业:
建筑工程
有效期:
2026年08月23日'
# 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