How to make an algorithm more concise

def figure_filter (self, url):

index = 0
end_figure = re.findall("[^/]+(?!.*/)", url)
if end_figure:
    all_figure = re.findall("\d+", end_figure[0])
    for each_figure in all_figure:
        if len(each_figure) < 5:
            index += 1
    if index == len(all_figure):
        return url

the counter I use here is to calculate a regular match of all numbers less than 5 and return this url, but I use an index count, is there a more concise way to write

Oct.26,2021

although not python, you can fix
with regular matching [5-9] + if it succeeds, there is a number > = 5
if it fails, return URL


the method of @ Fractal upstairs is feasible.
all digits whose length is less than 5 are returned equivalent to only one or more digits whose length is greater than 5 are not returned
the following is the supplementary python code

import re
def figure_filter(url):
    end_figure = re.findall('[^/]+(?!.*/)', url)
    if end_figure:
        -sharp check if there is figure with length > 5
        long_figure = re.findall('\d{5,}', end_figure[0])
        if not long_figure:
            return url
        
print(figure_filter('http://www.12a123b123c.com')) -sharp http://www.12a123b123c.com
print(figure_filter('http://www.12a345678bc.com')) -sharp None
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e48847-44449.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e48847-44449.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?