re = /((?:[^\n][\n]?)+) #flashcard ?\n*\(tab\)((?:(?:.{1,3}$|.{4}(?<!<!--).*)\n?)+)/m
str = '- Art. 970. A lei assegurará tratamento Favorecido, Diferenciado e Simplificado ao #flashcard
(tab)- Empresário rural e ao
(tab)- Pequeno empresário
group 1:- Art. 970. A lei assegurará tratamento Favorecido, Diferenciado e Simplificado ao
group 2:
(tab)- Empresário rural e ao
(tab)- Pequeno empresário'
# 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