I need to find all the occurrences of _X_
in a string (where X is any upper case English letter, that is A-Z
Consider this string: "_A_B_C_D_"
The occurrences I am looking for are
_A_
_B_
_C_
_D_
Using C# Regex.Matches:
var input = "_A_B_C_D_";
var pattern = "_[A-Z]_";
var matches = Regex.Matches(input, pattern);
The result is
_A_
_C_
so, obviously my pattern is wrong.
What is the correct pattern?
Update: Thanks folks. This works. (?=(_[A-Z]_))