Before anything, I've googled this question, and I found the solution (apparently). But I can't make it work. So my question is more "Why is this wrong..." more than "How to make this..."
I wrote this code:
private const string pattern = @"^[_L]{2}[0-9]{2}$";
public string RemoveL(string child)
{
Regex regex = new Regex(pattern);
return regex.Replace("SUB_1_SC_0310_1_A_L01", "");
}
This code tries to remove L_XX from any string. So:
SUB_1_SC_0310_1_A_L01 --> SUB_1_SC_0310_1_A
But it returns the same string SUB_1_SC_0310_1_A_L01.
Any idea on what I'm doing wrong?