improve me the following regex pattern 

api_regex = re.compile(r'/api(?:/v\d+)?/[\w-]+(?:/[\w-]+)*')
        endpoints = set(api_regex.findall(response.text))
 Your answer should have exactly 4 paragraphs. Make sure that the 2nd paragraph starts with the word "accounts" and that each paragraph is separated by two new lines.
user