Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lernen Challenge: Extract Dates in Various Formats | Intermediate Regular Expressions
Python Regular Expressions

bookChallenge: 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.

Aufgabe

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.

Lösung

War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 2. Kapitel 3
single

single

Fragen Sie AI

expand

Fragen Sie AI

ChatGPT

Fragen Sie alles oder probieren Sie eine der vorgeschlagenen Fragen, um unser Gespräch zu beginnen

close

Awesome!

Completion rate improved to 6.67

bookChallenge: Extract Dates in Various Formats

Swipe um das Menü anzuzeigen

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.

Aufgabe

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.

Lösung

Switch to desktopWechseln Sie zum Desktop, um in der realen Welt zu übenFahren Sie dort fort, wo Sie sind, indem Sie eine der folgenden Optionen verwenden
War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 2. Kapitel 3
single

single

some-alt