import re

link_re = re.compile("https?://\S+(\s|$)")


def extract_url(message):
    """
    Returns the first url in a message. If there aren't any returns None
    """
    answer = link_re.search(message)

    if answer is not None:
        answer = answer.group(0).strip()

    return answer

import re

link_re = re.compile("(\s|^)<(https?://[\w./?+]+)>(\s|$)")


def extract_url(message):
    """
    Returns the first url in a message. If there aren't any returns None
    """
    answer = link_re.search(message)

    if answer is not None:
        answer = answer.group(2).strip()

    return answer

Change regex to adapt to the <url> format
fix: Change regex to adapt to the <url> format

  import re
  
- link_re = re.compile("https?://\S+(\s|$)")
+ link_re = re.compile("(\s|^)<(https?://[\w./?+]+)>(\s|$)")
  
  
  def extract_url(message):
      """
      Returns the first url in a message. If there aren't any returns None
      """
      answer = link_re.search(message)
  
      if answer is not None:
-         answer = answer.group(0).strip()
+         answer = answer.group(2).strip()
  
      return answer
  
Change regex to adapt to the <url> format
## Code Before:
import re

link_re = re.compile("https?://\S+(\s|$)")


def extract_url(message):
    """
    Returns the first url in a message. If there aren't any returns None
    """
    answer = link_re.search(message)

    if answer is not None:
        answer = answer.group(0).strip()

    return answer

## Instruction:
Change regex to adapt to the <url> format
## Code After:
import re

link_re = re.compile("(\s|^)<(https?://[\w./?+]+)>(\s|$)")


def extract_url(message):
    """
    Returns the first url in a message. If there aren't any returns None
    """
    answer = link_re.search(message)

    if answer is not None:
        answer = answer.group(2).strip()

    return answer
