Sub test()
Dim Big$, NbBlocK&, char
t = [A1].Value
char = "1"
MsgBox GetLongRepitExpression(t, char, 0) ' la plus grande répétition
MsgBox GetLongRepitExpression(t, char, 1) ' le nombre de block toute longueur confondue
End Sub
Function GetLongRepitExpression(t, char As String, x As Long)
Dim I&, A&, tablo, Big$
For I = 1 To Len(t)
If Mid(t, I, Len(char)) <> char Then Mid(t, I, Len(char)) = Application.Rept(" ", Len(char))
Next
t = Application.Trim(t)
tablo = Split(t, " ")
For I = 0 To UBound(tablo)
If Len(tablo(I)) > A Then A = Len(tablo(I)): Big = tablo(I)
Next
Debug.Print t
Debug.Print UBound(tablo) + 1
Debug.Print Big
Select Case x
Case 0: GetLongRepitExpression = Big
Case 1: GetLongRepitExpression = UBound(tablo) + 1
Case 2: GetLongRepitExpression = Len(Big)
Case Else: GetLongRepitExpression = "IvalidArgumnts!"
End Select
End Function