re = /^(?i)(?!-+\s+Page\s+\d+-+|Python\s+Regular\s+Expression\s+\d{2}.+\d{4}|.+Python\s+Proprietary|PYTHON\s+RE SPECIFICATION\s+Version.+\s+page\s+\d+|Python\s+Regular\s+Expression\s+Specification).+$/m
str = '
This module provides regular expression matching operations.
Regular expressions use the backslash character (\'\\\') to indicate special forms
or to allow special characters to be used without invoking their special
meaning.
Python Regular Expression 02 December 1999
Python Proprietary
----------------------- Page 292-----------------------
PYTHON RE SPECIFICATION Version 2.7 [Vol 9, Part Q] page 983
Python Regular Expression Specification
It is important to note that most regular expression operations are available as
module-level functions and RegexObject methods. The functions are shortcuts that
don’t require you to compile a regex object first, but miss some fine-tuning
parameters.
'
# 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