Q:

How to parse data excluding a word and/or parentheses?

I have wrote a program to extract some data from a spreadsheet, but I want to make it ignore parentheses and a word when they exist in the cell. The spreadsheet contains city names, county names, and tax rates.
For city in most cases the cell only contains the city name, but sometimes it also has parentheses with the word "city" inside. 
Benton (city)

I'm looking for a solution to make my program only retrieve the city without the parentheses.
Benton

For county every single record contains the name of the county as well as the word "county".
Crawford County

I would like to only retrieve the name of the county.
Crawford

For county I know that I could use the split method, but I would like suggestions for an optimal way of handling both of these cases. The rest of the script works fine. I just need to refine the data.
For anyone who would like to see how I'm processing the data. Here is the code: 
public static List<CityTax> getCityTaxRates(string fileName)
        {
            Excel.Application xlApp = new Excel.Application();
            Excel.Workbook xlWorkbook = xlApp.Workbooks.Open(@fileName);
            Excel._Worksheet xlWorksheet = xlWorkbook.Sheets[1];
            Excel.Range xlRange = xlWorksheet.UsedRange;
            List<CityTax> cityTaxList = new List<CityTax>();
            Console.WriteLine("City Tax Rates----------------------------------------------------------------");
            for (int i = 10; i <= 312; i++)
            {
                CityTax cityTaxRate = new CityTax();
                cityTaxRate.city = xlRange.Cells[i, 2].Value2.ToString();
                cityTaxRate.cityRate = Convert.ToDecimal(xlRange.Cells[i, 5].Value2);
                cityTaxList.Add(cityTaxRate);
            }
            return cityTaxList;
        }

    public static List<CountyTax> getCountyTaxRates(string fileName)
    {
        Excel.Application xlApp = new Excel.Application();
        Excel.Workbook xlWorkbook = xlApp.Workbooks.Open(@fileName);
        Excel._Worksheet xlWorksheet = xlWorkbook.Sheets[1];
        Excel.Range xlRange = xlWorksheet.UsedRange;
        List<CountyTax> countyTaxList = new List<CountyTax>();
        Console.WriteLine("County Tax Rates----------------------------------------------------------------");
        for (int i = 316; i <= 390; i++)
        {
            CountyTax countyTaxRate = new CountyTax();
            countyTaxRate.county = xlRange.Cells[i, 2].Value2.ToString();
            countyTaxRate.countyRate = Convert.ToDecimal(xlRange.Cells[i, 5].Value2);
            countyTaxList.Add(countyTaxRate);
        }
        return countyTaxList;
    }

    public static void testTaxRates(string fileName)
    {
        List<CityTax> cityTaxList = new List<CityTax>();
        cityTaxList = ParseTaxRates.getCityTaxRates(fileName);
        foreach (CityTax cityTax in cityTaxList)
        {
            Console.WriteLine("City: " + cityTax.city);
            Console.WriteLine("Rate: " + cityTax.cityRate);
        }

        List<CountyTax> countyTaxList = new List<CountyTax>();
        countyTaxList = ParseTaxRates.getCountyTaxRates(fileName);
        foreach (CountyTax countyTax in countyTaxList)
        {
            Console.WriteLine("City: " + countyTax.county);
            Console.WriteLine("Rate: " + countyTax.countyRate);
        }
    } 

If you would like to see the spreadsheet that I'm retrieving the data from it can be downloaded from:
http://www.arkansas.gov/dfa/excise_tax_v2/st_zip.html
There reason for the static indexes in my loops are due to the layout of the spreadsheet. I'm open to suggestions for how to handle that as well. Right now I understand that I must always check the spreadsheet before running to make sure that the row numbers are still the same. It would be great to not have to worry about that, but I'm not sure how to handle it any other way.

A:

I'm not a RegEx expert by any means but:
This will match text preceding anything in parentheses:
(^.*) \(.*\)

And this will match text excluding the county suffix
(^.*) county

Or combined:
(^.*) (\(.*\)|county)

You should do this case insensitive if you are not sure if the text will be County or county for example.
Some example C# code:
var input = "blah blah County";
var regex = @"(^.*) (\(.*\)|county)";

var matches = Regex.Matches(input, regex, RegexOptions.IgnoreCase);

if(matches.Count > 0)
{
    var place = matches[0].Groups[1].Value;
}

