re = /(^(?:\s*\* \N+\n)+)/m
str = ' * Some text in a bullet list.
* Some more text in the same bullet list
Break my pattern with a random number of normal text.
That keeps going for some time
* Back to some text in a bullet list
* That goes on
'
# 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