re = /(?<=(\(\d\)|\d\.\d))(.(?!\(\d\)|\d\.\d))*/
str = '(4) The Governor-General may arrange\\n with the Chief Minister of the Australian Capital Territory for the variation or revocation of an \\n\\narrangement in force under subsection (3). \\nNorthern Territory \\n (5) The Governor-General may make arrangements with the \\nAdministrator of the Northern \\nTerritory with respect to the'
# 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