0

Let me explain this case since I tried to search this online already but I couldn't find the same case with this.

I have this binary number:

1011010110110

I am trying to find matches using this number:

101

Using this code:

Regex.Matches(result, "101").Count

This would return 3. But if you will look closely, the right answer should be 4.

Since there are 4 times you can find 101 on 1011010110110:

(101)1010110110
101(101)0110110
10110(101)10110
10110101(101)10

How should I write my Regex so that this will return 4 results or any approach you can advise me to achieve what I am trying to do.

Willy David Jr
  • 8,604
  • 6
  • 46
  • 57

0 Answers0