Challenge: Extract Dates in Various Formats
To strengthen your skills with grouping and quantifiers in regular expressions, you will now write a function to extract dates from text. The goal is to identify dates in the formats "YYYY-MM-DD" (such as 2024-06-15) and "DD/MM/YYYY" (such as 15/06/2024). Your function should scan a string and return all matching dates in a list. This exercise will help you practice using groups, quantifiers, and alternation to match multiple date formats reliably.
Swipe to start coding
Your task is to create a function that finds all dates in a string. The dates can be in either the "YYYY-MM-DD" format or the "DD/MM/YYYY" format. Use the Python regular expressions module to identify and extract each date. Return a list of all dates found in the input string.
Рішення
Дякуємо за ваш відгук!
single
Запитати АІ
Запитати АІ
Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат
Awesome!
Completion rate improved to 6.67
Challenge: Extract Dates in Various Formats
Свайпніть щоб показати меню
To strengthen your skills with grouping and quantifiers in regular expressions, you will now write a function to extract dates from text. The goal is to identify dates in the formats "YYYY-MM-DD" (such as 2024-06-15) and "DD/MM/YYYY" (such as 15/06/2024). Your function should scan a string and return all matching dates in a list. This exercise will help you practice using groups, quantifiers, and alternation to match multiple date formats reliably.
Swipe to start coding
Your task is to create a function that finds all dates in a string. The dates can be in either the "YYYY-MM-DD" format or the "DD/MM/YYYY" format. Use the Python regular expressions module to identify and extract each date. Return a list of all dates found in the input string.
Рішення
Дякуємо за ваш відгук!
single