re = /(?<!#)(?:(?<=_FILE).+"(.+)")/
str = '# ---------------------------------------------------------------------------- #
# Packages
# ---------------------------------------------------------------------------- #
set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "file_1_test_1_qip.vhd"]
set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "file_2_test_1_qip.vhd"]
set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "file_3_test_1_qip.vhd"]
# Register Tool set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "file_INVALID_test_1_qip.vhd"]
# ---------------------------------------------------------------------------- #
# Sub Modules
# ---------------------------------------------------------------------------- #
set_global_assignment -name QIP_FILE [file join $::quartus(qip_path) "module_test_2.qip"]
set_global_assignment -name QIP_FILE [file join $::quartus(qip_path) "module_test_3.qip"]
# ---------------------------------------------------------------------------- #
# Module Files
# ---------------------------------------------------------------------------- #
set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "file_4_test_1_qip.vhd"]
set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "file_5_test_1_qip.vhd"]'
# 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