I have this issue with patterns in C#.
I have this pattern:
1111100000000000000000000
It is a row of 25 1 or 0’s.
This pattern should match every string that has the same 1’s on the same place, but it should ignore if the string has 1 on the place that the pattern has 0.
The only thing the pattern should check is if the 1’s is one the right place.
ex.
The pattern should match:
1111100000000000000000000
1111100000001000100010001
1111111110000111100111100
But not:
0111110000101110001011000
1011111010101010101000000
I have tried this, with regular expressions:
var orginal_pattern = "1111100000000000000000000";
var match_pattern = "1111100000000000010000000";
var pattern = orginal_pattern.Replace("0", "[?]");
Debug.WriteLine(pattern);
var RegMatch = Regex.Match(match_pattern, pattern);
Debug.WriteLine(RegMatch.Success);
I hope someone could give me an idea.
Thank you!
Just convert your strings to int and use
ANDoperatorOUTPUT: