Sorry, for the confusion. What I mean is- a string could have several different possible combinations of "0" and "1" of different lengths. Out of all possibilities, I need to extract strings with more than 2 consecutive 1's, irrespective of whether they have 0's in start (eg., 0111) or end (e.g., 1110) or both (e.g., 01110, 00111100) or no 0's at all (eg., 111). In sporadic cases such as 00111011' or 0111001111 have more than 2 consecutive 1's, but also has 1's separated by 0's in other locations, however as it qualifies the condition it should be output