0 out of 68 challenges solved

Extract phone numbers from a string

Question:
Write a function called extract_phone_numbers that takes a string as input and returns a new list containing all the phone numbers found in the input string. Use regular expressions (regex) to extract the phone numbers.

Example:
Input: "Please contact us at +1 (123) 456-7890 or email support@example.com."
Output: ["+1 (123) 456-7890"]

import re

def extract_phone_numbers(string):
    """
    Extracts phone numbers from a given string using regex.

    Args:
        string (str): The input string.

    Returns:
        list: A new list with the extracted phone numbers.
    """
    # TODO: Implement the extract_phone_numbers function
    pass