Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lära 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.

Uppgift

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ösning

Var allt tydligt?

Hur kan vi förbättra det?

Tack för dina kommentarer!

Avsnitt 2. Kapitel 3
single

single

Fråga AI

expand

Fråga AI

ChatGPT

Fråga vad du vill eller prova någon av de föreslagna frågorna för att starta vårt samtal

close

Awesome!

Completion rate improved to 6.67

bookChallenge: Extract Dates in Various Formats

Svep för att visa menyn

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.

Uppgift

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ösning

Switch to desktopByt till skrivbordet för praktisk övningFortsätt där du är med ett av alternativen nedan
Var allt tydligt?

Hur kan vi förbättra det?

Tack för dina kommentarer!

Avsnitt 2. Kapitel 3
single

single

some-alt