using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"(?<!#)(?:(?<=_FILE).+""(.+)"")";
string input = @"# ---------------------------------------------------------------------------- #
# 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""]";
foreach (Match m in Regex.Matches(input, pattern))
{
Console.WriteLine("'{0}' found at index {1}.", m.Value, m.Index);
}
}
}
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 C#, please visit: https://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex(v=vs.110).aspx