re = /(?<=^\d+\. +).+?(?=\n|$)/m
str = '
Open Ended Questions:
1. What makes Vue a popular choice for web development?
2. How does Vue compare to other JavaScript frameworks?
3. What are the advantages of using Vue?
Closed Ended Questions:
1. Does Vue support server-side rendering?
2. Is Vue compatible with TypeScript?
3. Does Vue have a built-in router?'
# 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