re = /((?:(?:PUBLIC|PRIVATE)[ \t]+)*(?:(?:DEFAULT)[ \t]+)*PROPERTY[ \t]+(?:GET|SET|LET)[ \t]+(?:(\w+)(?:[ \t]*\(([^\(\)]*)\))*))(?:.*)END PROPERTY/im
str = ' public default property get abc (a, b, c)
ksdjflkj lkjlk jd()
lkjdlkfj
lkdjf (sdfd())
kljlkj sd
fd fdsflkdsjjdsk lkjsdlkj
end property'
# 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