I am trying to count the number of MAX consecutive digits that appear in a string column, let me give an example to illustrate better what I am trying to do. If I have a table called email
email
lucas1234@gmail.com
fer12@gmail.com
lupal@gmail.com
carlos1perez222@gmail.com
carlos11perez222@gmail.com
lucila1@gmail.com
my expected output would be
email count_cons_digits
lucas1234@gmail.com 4
fer12@gmail.com 2
lupal@gmail.com 0
carlos1perez222@gmail.com 3
carlos11perez222@gmail.com 3 lucila1@gmail.com 1
Check that this question is very similar to : Number of consecutive digits in a column string
but the only difference is that the function from the results is not contemplating cases with only one digit in the email (like lucila1@gmail.com). In this case, the expected result should be 1 but the proposed function is giving 0. And also whenever the email contains "two sections" of consecutive digits (carlos11perez222@gmail.com). In this case, the expected output is to be 3 but is given 5.

