Regex to capture both uppercase and lowercase letter

c#, regex

Solution

Use `String.Compare(String, String, Boolean)` method and supply true to the last argument to ignore case.

The method above returns negative, 0 or positive number.

If you only want `bool` value, you can use `String.Equals(String, String, StringComparison)` with `StringComparison.OrdinalIgnoreCase` option.

Problem

I'm creating a simple C# application where in it has a condition to capture both uppercase and lowercase of a letter. This is my condition: ``` if( txtChord.Text == "A" || txtChord.Text == "a" && cbKeys.SelectedIndex == 6 ){ txtAnswer.Text = "B"; } ``` I'd like to do this more efficiently using regex.

Original source