I am new to C and I am trying to detect if a user entered some regex of IntxInt (i.e. 2x5 or 10x15). I will not go over 15.
From what I have gathered I can just make a regex to detect this. I have been confused on making regex's for C though and no examples have been very useful yet.
I found this example here
string pattern = @"\*\d*\.txt";
Regex rgx = new Regex(pattern)
input = rgx.Replace(input, "");
And my guess of making it fit the above criteria would be something like this
string pattern = @"[0-9][0-9]*[x|X][0-9][0-9]*";
I would guess this as I need at least 1 digit, followed by possible another? Not sure how to limit it to 0 or 1 more numbers. Followed by an X. Then the same thing as the first part.
Is this right/wrong, why?
If this is correct, how do I "test" the input I get in?